View Single Post
  #4 (permalink)  
Old 06-08-2007, 10:39 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 91
Rep Power: 7
KevinADC is on a distinguished road
Default

Quote:
Originally Posted by The Fear View Post
Hi.
$argv1,$argv2,...
all in @ARGV.
example:
./perl sample.pl $argv1 $argv2
@ARGV = $argv1,$argv2
$ARGV[0] = $argv1
$ARGV[1] = $argv2

#Good luck
The above code is not quite correct. Perl sends the arguments to the program in the @ARGV array. You get them back out of the @ARGV array like so:


Code:
my ($arg1,$arg2) = @ARGV;
or:

Code:
my $arg1 = $ARGV[0];
my $arg2 = $ARGV[1];
Reply With Quote