{ my $x; sub foo { return ++$x; } } for (1..7) { print foo() } #### sub foo { my $x if undef; return ++$x; } for (1..7) { print foo() }