Not really a closure problem, could happen with package vars too.
One best practice to avoid such problems is to use a "generator sub" with the whole closure-context like in your block and returning \&do_something
like:
sub generate { my $FIXED_STRING = 'fixed_string'; my %persistent; return sub { ... }
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: Closure Over Scalar?
by LanX
in thread Closure Over Scalar?
by QM
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |