July 2002
Beginner to intermediate
432 pages
8h 55m
English
The special variable @ARGV contains the command-line arguments for the program. For example, if you run a script with the command
$ perl doit.pl alpha beta gamma
Then
$ARGV[0] = "alpha"; $ARGV[1] = "beta"; $ARGV[2] = "gamma";
To get the number of arguments, use the notation $#ARGV (there is no argc). Note that unlike in C programming, the first argument is not the name of the program. If you need the name of the program, it’s assigned to the variable $0.
Read now
Unlock full access