Mike Blomgren writes:
> I have encountered a problem with the way ActivePerl handles @ARGV and
> wildcard expansion under Win32 and Solaris, and I don't know how to get
> around it in an efficient manner.
>
> I have a single perl script which needs to run under both Win32 and
> Solaris, and I have no intention whatsoever to maintain two versions of
> the same script. The script takes a commandline argument, in the form
> of a filename, with or without wildcards, eg 'myscript.pl <file?name*>
> <other_arguments> <more_arguments>'. The problems arise when using
> wildcards in the filename under Solaris.
>
> The problem, is that under Solaris, the script does a 'wilcard
> expansion', and places all the found filenames in $ARGV[0], $ARGV[1],
> $ARGV[2] and so on, while under Win32 the filename argument (including
> the wildcards) is placed in $ARGV[0], and the remaining arguments in
> $ARGV[1], $ARGV[2] etc. And this is the way I want it to work under
> Solaris too.
All unix command shells (that I know of) do wildcard expansion, unless
the wildcard charaters are quoted, as you already know, or are escaped
in some way (usually with a backslash). Native Win32 command shells
don't do wildcard expansion.
All of this takes place before perl is executed, so this is nothing at
all to do with Perl.
>
> Putting single quotes around the filename argument under Solaris
> prevents the expansion, but then the script doesn't behave as I'd
> like... And not in the same way as under Win32. I need the script to
> be 'transparent' in the sense that it must function identically in both
> environments.
>
> So, to summarize, my question boils down to: How do I enter a filename
> including wildcards as a command line argument to a perl script under
> Solaris, without having the wildcard expansion being performed, and
> wrongly overwriting the following arguments in @ARGV? And without using
> single quotes around the argument.
--
Brian Raven
Even if you aren't in doubt, consider the mental welfare of the person who
has to maintain the code after you, and who will probably put parens in
the wrong place. -- Larry Wall in the perl man page
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl