The stupid question is the question not asked | |
PerlMonks |
Re: Defining a sub within a sub: OK?by BrowserUk (Patriarch) |
on Oct 14, 2009 at 22:45 UTC ( [id://801230]=note: print w/replies, xml ) | Need Help?? |
The main problem with nested subs, beyond the misleading apparent scoping of the innermost definition, is that Perl can only handle one level of closure, as (rather obliquely) indicated by the error message:
By the time you leave the definition of sub a(), the variable $x no longer exists, but sub b(), is still callable. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|