Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983725]
[Discipulus]: good first day of Spring nuns and monks
[LanX]: yeah let's break the ice!

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2018-03-21 07:57 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (264 votes). Check out past polls.