water has asked for the wisdom of the Perl Monks concerning the following question:
Hi --
I have list, @x, that is actually a flattened list triples:
What's the nice perlish to map this back to an LOL of triples:@x = (( $x1a, $x1b, $x1c), ( $x2a, $x2b, $x2c), ( $x3a, $x3b, $x3c), . +.. etc ... ($xna, $xnb, $xnc));
I'm using an explicit loop with three shifts to pull off the elements by threes. It works, but I'd like to learn the more idiomatic perlish solution. Thanks for the insight --[[$x1a, $x1b, $x1c], [$x2a, $x2b, $x2c], [$x3a, $x3b, $x3c], ... etc . +.. [$xna, $xnb, $xnc]]
bottled water
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perlish mapping a list to triples
by dave_the_m (Monsignor) on Jun 06, 2004 at 01:38 UTC | |
Re: perlish mapping a list to triples
by BrowserUk (Patriarch) on Jun 06, 2004 at 02:12 UTC | |
Re: perlish mapping a list to triples
by Django (Pilgrim) on Jun 06, 2004 at 11:56 UTC | |
Re: perlish mapping a list to triples
by ambrus (Abbot) on Jun 06, 2004 at 18:28 UTC |
Back to
Seekers of Perl Wisdom