in reply to Re: How to avoid closures and memory leaks.in thread How to avoid closures and memory leaks.
my $temp = "a"; sub test { my $temp = $test; } [download]
please read the link provided about Coping with Scoping and please use <code> tags!
Basically does a my variable (aka lexical) belong to the surrounding '{ BLOCK }'.
A sub's (or an if's) body is a { BLOCK } and the file itself (i.e w/o surrounding curlies) is practically the top-level block.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)