Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
my %hash = @list will stringify the first of every pair of elements in the array, as well as remove all but the last of every pair, the first elements of which stringify to the same "key". ... plus, it is not easily generalizable to more than two elements at a time ... Okay, I guess I should make a suggestion as well:
In most cases this will be enough though (but I would not trust it with continue blocks):
Neither method aliases the list elements; to do that nicely you need a tie() or two. Or just work with references to or directly upon $list[$i] and $list[$i+1]. The Sidhekin In reply to Re: Answer: How do I loop through a list two or more elements at a time?
by Sidhekin
|
|