Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: simple anonymous subroutine and variable interpolation timing question

by ikegami (Patriarch)
on Jun 23, 2011 at 21:24 UTC ( #911173=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $sub = sub { my ($str) = @_; sub { $str } }->($str);
    
  2. or download this
    my $sub = sub { my $str = $str; sub { $str } }->();
    
  3. or download this
    my $sub = do { my $str = $str; sub { $str } };
    
  4. or download this
    my $str_copy = $str;
    my $sub = sub { $str_copy };
    
  5. or download this
    for my $str (...) {
       ... sub { ... $str ... } ...
    }
    
  6. or download this
    sub make_list_iterator { 
       my @list = @_;
    ...
    }
    
    my $iter = make_list_iterator(@list);
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2023-03-27 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (66 votes). Check out past polls.

    Notices?