http://qs321.pair.com?node_id=121066

moodster has asked for the wisdom of the Perl Monks concerning the following question: (arrays)

If I have a list like this one:
@list = qw( a b c d e f );
I can easily loop through each element with a simple for loop like this:
for $el (@list) { print "$el\n"; }
But suppose the elements in the loop are grouped two and two and that for each loop I want to get two elements. Something like this (I know the syntax is all wrong):
for $el1, $el2 (@list) { print "$el1 - $el2\n"; }
I know there must be an easy way to do this (this being perl and all), but I can't figure it out. Anyone?

Originally posted as a Categorized Question.