#!perl -l sub blah { my $x if $foo; print $x++; } for (0..3) { blah() } $foo = 1; for (0..3) { blah() } __END__ 0 1 2 3 4 0 0 0