Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Processing pairs of values from even-sized array

by Fletch (Chancellor)
on Jun 03, 2011 at 12:41 UTC ( #907966=note: print w/ replies, xml ) Need Help??


in reply to Processing pairs of values from even-sized array

List::MoreUtils has pairwise and natatime, the former which works like a two-at-a-time map and the later makes an iterator that you kick in a while loop.

Example: my @x = ('a' .. 'g'); my $it = natatime 3, @x; while (my @vals = $it->()) { print "@vals\n"; } This prints a b c d e f g

The cake is a lie.
The cake is a lie.
The cake is a lie.


Comment on Re: Processing pairs of values from even-sized array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (15)
As of 2014-08-28 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (260 votes), past polls