in reply to Re: (tye)Re2: A Real Closure
in thread Unusual Closure Behaviour
I've also used that behaviour to get less-global shared variables. I was working around an even uglier problem and this isn't the sort of thing I'd recommend for general usage but it is another useful usage.
{ my $x=0; sub foo { $x } sub bar { $x } }
|
---|
In Section
Seekers of Perl Wisdom