|
|
| P is for Practical | |
| PerlMonks |
Re: Refactoring: sub within a subby moritz (Cardinal) |
| on Jul 25, 2012 at 19:38 UTC ( #983725=note: print w/ replies, xml ) | Need Help?? |
|
Why are anonymous subs more acceptable? Since subs are package-scoped in Perl 5, the inner subs are visible from the outside. Which means that they are visible before the outer sub is run, which is why they can't easily be a closure over the variables from the outer sub. Which is why anonymous subroutines are safer in this case.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||