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

Re: Square the array values.

by pajout (Curate)
on Mar 18, 2010 at 09:39 UTC ( #829359=note: print w/replies, xml ) Need Help??


in reply to Square the array values.

Though it could be considered ugly, map can help you:

pajout@balvan:~$ perl -e 'my @a = (1,2,3); print join(",", map {$_*$_} + @a)."\n";' 1,4,9

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://829359]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2016-12-11 05:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (168 votes). Check out past polls.