in reply to Re: What I Most Recently Learned in Perl, But Should Have Already Known
in thread What I Most Recently Learned in Perl, But Should Have Already Known

# $rec is an alias...

It's the previously declared lexical, implicitly localized. See perldoc perlsyn...

Shorter example, without the need to blame AoH for the problem:

my $var = 4; for $var (1 .. 9) { last if $var == 7; } print $var; # prints: 4