|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re: foreach-loop-local var in subby LanX (Monsignor) |
| on Jan 21, 2013 at 17:51 UTC ( #1014504=note: print w/ replies, xml ) | Need Help?? |
|
... strange, in your case I would expect to see a warning like "variables won't stay shared"... These kind of problems are easily avoided by either using lexical subs:
or just not expecting to be able to easily redefine package subs at runtime, they are defined only once at compile time:
Anyway, while there are good use-cases for closures, I'd expect a beginner to go easy and pass arguments normally :
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||