Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
XP is just a number
 
PerlMonks  

Re: Refactoring: sub within a sub

by moritz (Cardinal)
on Jul 25, 2012 at 19:38 UTC ( #983725=note: print w/ replies, xml ) Need Help??


in reply to Refactoring: sub within a sub

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.


Comment on Re: Refactoring: sub within a sub

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983725]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-04-21 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (490 votes), past polls