in reply to (tye)Re: Unusual Closure Behaviour
in thread Unusual Closure Behaviour
his first example
is very much a closure, because $x is lexically scoped to that block, and sub foo is by definition global and survives the loop, $x goes away, except for the one reference in sub foo. his second one, however, would not be a closure.{ my $x; sub foo { return ++$x; } }
- Ant
In Section
Seekers of Perl Wisdom