in reply to Re^2: Invalid argument
in thread Invalid argument
You can also do something likemy $test = 1; print "$test\n"; { my $test = 2; print "$test\n"; test(3); } print "$test\n"; sub test { my($test) = @_; # parens make list assignment, otherwise you get the + count of items in @_ print "$test\n"; } #prints... 1 2 3 1
while(my $var = shift @ARGV) { print "$var\n"; # var is scoped only in the while loop }
|
---|