Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: anonymous vs named subroutines as closures

by ikegami (Pope)
on Jun 04, 2013 at 04:16 UTC ( #1036884=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub outer {
        my ($x) = @_;
    ...
    
    outer(4);  # Prints 4
    outer(6);  # Prints 4!!!
    
  2. or download this
    sub named { ... }
    
  3. or download this
    BEGIN { *named = sub { ... }; }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2014-07-23 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (152 votes), past polls