[PLUG] Perl & command line arguments

Jeff DeFouw defouwj@purdue.edu
Thu, 9 Sep 1999 18:48:22 -0500 (EST)


On Thu, 9 Sep 1999, Fred Davis wrote:

> I have one question: Is it possible to get a Perl script to recognize
> command line arguments (like $1, $2 in a shell script)? Or would I have to
> add this functionality through a shell script that would call the Perl
> script?

Command line arguments are stored in @ARGV, so:

$1 in shell -> $ARGV[0] in perl
$2 in shell -> $ARGV[1] in perl
etc. scalar(@ARGV) = # of args, $#ARGV = index # of last arg

--
Jeff DeFouw <defouwj@purdue.edu>