Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Closure - Perl Perspective

by tobyink (Canon)
on Oct 17, 2014 at 09:13 UTC ( #1104148=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use v5.14;
    
    ...
    sub foo {
       return(2 + $foo);
    }
    
  2. or download this
    use v5.14;
    
    ...
    say $counter->();
    say $other->();
    say $counter->();
    
  3. or download this
    use v5.14;
    use Scalar::Util qw/refaddr/;
    ...
    
    say join "|" => map refaddr($_), @closures;
    say join "|" => map refaddr($_), @nonclosures;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104148]
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 2022-05-17 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (65 votes). Check out past polls.

    Notices?