[Pdx-pm] evil @ARGV syntax
Michael Rasmussen
mikeraz at patch.com
Wed Jul 20 05:47:01 PDT 2005
Michael G Schwern wrote:
> It also doesn't say much about regular expressions, threading,
> object-oriented programming or EBCDIC.
>
> NAME
> perlvar - Perl predefined variables
>
> DESCRIPTION
> Predefined Names
>
> The following names have special meaning to Perl.
For a topic that confuses new Perl folk this would seem to be something
that should be covered at every available opportunity. The section on
@ARGV does cover the $# issue:
@ARGV The array @ARGV contains the command-line arguments intended
for the script. $#ARGV is generally the number of arguments
minus one, because $ARGV[0] is the first argument, not the
program’s command name itself. See $0 for the command name.
It's incredible easy to expand that to:
@ARGV The array @ARGV contains the command-line arguments intended
for the script. @ARGV evaluated in a scaler context returns
the number of arguments. $#ARGV is generally the number of
arguments minus one, because $ARGV[0] is the first argument,
not the program’s command name itself. See $0 for the
command name.
Which would be a GoodThing considering the trouble that people have
with the issue.
--
Michael Rasmussen, Portland Oregon
Be appropriate && Follow your curiosity
http://meme.patch.com/memes/BicycleRiding
Get Fixed: http://www.dampfixie.org
The fortune cookie says:
If A = B and B = C, then A = C, except where void or prohibited by law.
-- Roy Santoro
More information about the Pdx-pm-list
mailing list