in reply to tcl like 1 loop with two operators
I'd use List::MoreUtils::natatime ("n at a time"):
my $it = natatime 3, 1,2,3,4; while (my $i, $j = $it->()) { ... };
... or, if you have the data in two lists already, List::MoreUtils::pairwise (or ::each_arrayref, but have a look List::MoreUtils yourself)
pairwise { print $a; print $b; } @a, @b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: tcl like 1 loop with two operators
by AnomalousMonk (Archbishop) on Jan 24, 2011 at 17:30 UTC |