Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: How to avoid closures and memory leaks.by LanX (Saint) |
on Oct 18, 2014 at 16:47 UTC ( [id://1104242]=note: print w/replies, xml ) | Need Help?? |
well if you meant $temp instead of $test ... YES!
please read the link provided about Coping with Scoping and please use <code> tags!
updateBasically 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 ☆☆☆☆ :)
In Section
Seekers of Perl Wisdom
|
|