I like List::MoreUtils natatime for this sort of task:
use List::MoreUtils qw( natatime ); my $next_two = natatime 2, @x; while ( my ( $x, $y ) = $next_two->() ) { # do something with $x & y };
In reply to Re^2: best way to implement multiple foreach iterator variables?
by adrianh
in thread best way to implement multiple foreach iterator variables?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |