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