in reply to Closure Over Scalar?
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
|
---|