my @ary = qw(a b c d e f g); @_ = @ary; while (my ($one,$two) = (shift @_, shift @_)) { print "$one $two\n"; last unless defined $two; }
Originally posted as a Categorized Answer.
In reply to Re: How do I loop through a list two or more elements at a time?
by tachyon
in thread How do I loop through a list two or more elements at a time?
by moodster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |