use strict; use warnings; for my $foo (1,2,3) { print $foo; } # The next line is a compile-time error: $foo is not declared here: print "Scalar variable foo now contains: $foo";