http://www.perlmonks.org?node_id=96028


in reply to (tye)Re: Unusual Closure Behaviour
in thread Unusual Closure Behaviour

his first example
{ my $x; sub foo { return ++$x; } }
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.

                - Ant