Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: map sub to list?

by Arunbear (Parson)
on Sep 09, 2013 at 16:58 UTC ( #1053044=note: print w/ replies, xml ) Need Help??


in reply to map sub to list?

If you're just adding 1 to each element then defining a separate sub is overkill:

% perl -de0 Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 0 DB<1> @a = (1, 2, 3) DB<2> x @a 0 1 1 2 2 3 DB<3> x map { $_ + 1 } @a 0 2 1 3 2 4 DB<4> q %


Comment on Re: map sub to list?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-12-17 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (40 votes), past polls