$ cat argvtest.pl
printf "I saw %d arguments\n",$#ARGV+1; #show how many
@argsin=@ARGV; # Snarf in the argnuments
printf "They were \"%s\"\n",join(",",@argsin); # and what
####
$ perl argvtest.pl 1 2 3 4
I saw 4 arguments
They were "1,2,3,4"
####
if ( $#ARGV < 0 ) { # NOTE: not != 0
printf "I expected an argument not simple refutation\n";
exit(0);
}
####
@RecievedArray=$ARGV[0];
####
use Data::Dumper;
@ry=qw/ a b c d /;
@ry2=$ry[0];
printf "First array:\n";
print Dumper(\@ry);
printf "Second array:\n";
print Dumper(\@ry2);
####
First array:
$VAR1 = [
'a',
'b',
'c',
'd'
];
Second array:
$VAR1 = [
'a'
];