Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 romping around the Monastery: (3)
As of 2016-02-06 01:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (212 votes), past polls