Yes, each does not create a list. On the other hand, it does copy the value (and create a new scalar for the key, because the keys in hashes are not full blown scalars).
Which one to use depends, though - if you're dealing with a DBM tied hash, you'd probably not want to use values.. or for some of the half-million-key monsters I'm dealing with at the moment.
Also, I tend to prefer each when I'm dealing with every pair stored in hash but in no particular order, because it reduces redundancy. I don't need to name the hash in question more than a single time.
Makeshifts last the longest.
In reply to Re^4: Counting keys with defined or undefined elements in a hash (behaviour of values())
by Aristotle
in thread Counting keys with defined or undefined elements in a hash
by Bukowski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |