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


in reply to Re: Unusual Closure Behaviour
in thread Unusual Closure Behaviour

Hi I think this clarifies the situation. $x is definitely lexically scoped. Run this as in then uncomment the use strict.

# use strict; sub foo { my $x if 0; return ++$x; } for (1..7){ print foo(); print "($x)"; };
cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print