sub test { my $global_lexical_sorta = 0; my $other = 0; my $local_sub = sub { $global_lexical_sorta ++ }; sub named { $other ++ } $local_sub->() for 1 .. 10; &named for 1 .. 10; print "$global_lexical_sorta $other\n"; } &test; &test; # you get 10 10 -- $gls and $o are each incremented to 10 # and 10 0 -- the second $gls is incremented to 10, but ... # the first $o is incremented to 20 while the second $o is not incremented!