Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 surveying the Monastery: (8)
As of 2014-09-22 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (184 votes), past polls