Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 meditating upon the Monastery: (12)
As of 2015-07-03 17:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls