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

Re: How do I un-map this code?

by dragonchild (Archbishop)
on Mar 21, 2008 at 18:19 UTC ( #675494=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @l = ( 5, 4, 3, 2, 1 );
    
    my @sorted  = sort { $a <=> $b } @l; # Sorted is ( 1, 2, 3, 4, 5 )
    my @grepped = grep { $_ > 2 } @l;    # Grepped is ( 5, 4, 3 )
    my @mapped  = map  { $_ * 2 } @l;    @ Mapped is ( 10, 8, 6, 4, 2 )
    
  2. or download this
    my @l = ( 5, 4, 3, 2, 1 );
    
    ...
       ==> @final;
    
    # Final contains ( 6, 8, 10 )
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-09-18 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (118 votes), past polls