Do you know where your variables are? | |
PerlMonks |
Re: foreach-loop-local var in subby Athanasius (Archbishop) |
on Jan 21, 2013 at 16:33 UTC ( [id://1014491]=note: print w/replies, xml ) | Need Help?? |
Hello warshall, and welcome to the Monastery! Just to reinforce the explanations given by choroba and tobyink, here is what the Camel Book (4th Edition, page 358) says about Nested subroutines: If you are accustomed (from other programming languages) to using subroutines nested within other subroutines, each with their own private variables, you’ll have to work at it a bit in Perl. Named subroutines do not nest properly, although anonymous ones do.9 Hope that helps,
In Section
Seekers of Perl Wisdom
|
|