moodster has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (arrays)
If I have a list like this one:
I can easily loop through each element with a simple for loop like this:@list = qw( a b c d e f );
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 $el (@list) { print "$el\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?for $el1, $el2 (@list) { print "$el1 - $el2\n"; }
Originally posted as a Categorized Question.
|
---|
Back to
Seekers of Perl Wisdom