laziness, impatience, and hubris | |
PerlMonks |
Re: code that fails to act as expected...by varian (Chaplain) |
on Jun 13, 2007 at 11:47 UTC ( [id://620919]=note: print w/replies, xml ) | Need Help?? |
When called in list context (like here) each will indeed give the next key/value pair. However one cannot tell for sure that the first key returned is abbot (and its value costello) because hashes are *not* sorted and the key sequence is done (more or less) randomly.
BTW when you call each in scalar context it would only return the key, not the related value. The keys function will help you sort the other question.
In Section
Seekers of Perl Wisdom
|
|