while(my $var = shift @ARGV) { print "$var\n"; # var is scoped only in the while loop }