good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: Defining a sub within a sub: OK?by AnomalousMonk (Archbishop) |
on Oct 14, 2009 at 21:59 UTC ( [id://801223]=note: print w/replies, xml ) | Need Help?? |
Your code does not define a sub within a sub, but a sub within a code block.Actually, the sub level1 is defined (and called) within an explicit scope, not within a code block. Since there are no lexicals also defined within the scope and referred to by the subroutine, the scope has no effect; subroutines themselves are globally scoped.
In Section
Seekers of Perl Wisdom
|
|