in reply to foreach-loop-local var in sub
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
9 To be more precise, globally named subroutines don’t nest. Unfortunately, that’s the only kind of named subroutine declaration we have. We haven’t yet implemented lexically scoped, named subroutines (known as my subs), but when we do, they should nest correctly.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: foreach-loop-local var in sub
by tobyink (Canon) on Jan 21, 2013 at 16:57 UTC | |
by muba (Priest) on Jan 22, 2013 at 06:23 UTC | |
by LanX (Saint) on Jan 22, 2013 at 18:20 UTC | |
by muba (Priest) on Jan 22, 2013 at 19:36 UTC |