Here is the example:
$a = shift;
$b = shift;
push(@ARGV,$b);
$c = <>;
print "\$b: $b\n";
print "\$c: $c\n";
print "\$ARGV: $ARGV\n";
print "\@ARGV: @ARGV\n";
And the output:
$b: file1
$c: dir3
$ARGV: file2
@ARGV: file3 file1
I don't understand what exactly is happening when printing $ARGV without any index. Does it print the first argument and then remove it from the array? Because I thought after all the statements the array becomes:
file2 file3 file1
Invocation:
perl port.pl -axt file1 file2 file3
file1 contains the lines:
dir1
dir2
file2:
dir3
dir4
dir5
file3:
dir6
dir7