my $i; $i = 123; sub foo { my $arg = shift; print "$arg, $i\n"; } foreach $i (0..2) { foo($i); } foo('x'); # Prints, # 0,123 # 1,123 # 2,123 # x,123