Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

[Solved] How does map work?

by three18ti (Monk)
on Oct 26, 2013 at 20:07 UTC ( [id://1059839]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub imap {
        my ($transform, $it) = @_;
    ...
            return $transform->($next);
        }
    }
    
  2. or download this
    #!/usr/bin/env perl
    use 5.010;
    ...
    
    my @a = ( "1", "2", "3", "4", );
    my @b = foo { $_ ** 2 } @a;
    
  3. or download this
    my @b = foo { $_ = shift; $_ ** 2 } @a;
    my @b = foo { my $var = shift; $var ** 2 } @a;
    
  4. or download this
    #!/usr/bin/env perl
    use 5.010;
    ...
    
    my @a = ( "1", "2", "3", "4", );
    my @b = foo { $_ ** 2 } @a;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1059839]
Front-paged by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found