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

Re: perlish mapping a list to triples

by BrowserUk (Patriarch)
on Jun 06, 2004 at 02:12 UTC ( [id://361724]=note: print w/replies, xml ) Need Help??


in reply to perlish mapping a list to triples

If you don't want to destroy the original array with splice then you could do

my @a = 1..30; my @b = map{ [ @a[ $_ .. $_ +2 ] ] } map{ $_ *3 } 0 .. $#a/3; print "@$_" for @b;; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found