On Mon, 4 Jun 2001, George Petri wrote:
>
> Hi!
>
> In a book called "Open Source Linux Web Porgramming" by Jones and Batchelor,
> it says (on Page 61):
>
> "When you launch a script from the command line, for example, @_ populates
> with all of the parameters passed in through the command line. The shift
> function, among others, will use @_ by default if no other array is provided.
If your book says this, then it's wrong on 2 counts, both of which you
seem to have discovered yourself:
1) command-line parameters are passed through the @ARGV array, as
documented in perldoc perlvar, and
2) shift will shift @_ in a function, and @ARGV in global scopes, rather
than always working on @_. See perldoc -f shift for more detail.
>
> #!/usr/bin/perl
> @firstCommandLineArg=shift;
> @secondCommandLineArg=shift;"
Unless you actually plan to keep more than one argument in
@firstCommandLineArg, perhaps you should use a scalar, like
$firstCommandLineArg.
--
Tony