sub foo { my $x if 0; print "X is ", $x++, $/; } foo() for 3 .. 5; ---- X is 0 X is 1 X is 2