in reply to Re: Re^2: Counting keys with defined or undefined elements in a hash (behaviour of values())
in thread Counting keys with defined or undefined elements in a hash
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^4: Counting keys with defined or undefined elements in a hash (behaviour of values())
by Oberon (Monk) on Jun 07, 2003 at 02:18 UTC | |
by Aristotle (Chancellor) on Jun 07, 2003 at 02:27 UTC | |
by Oberon (Monk) on Jun 07, 2003 at 02:34 UTC | |
by Aristotle (Chancellor) on Jun 07, 2003 at 10:17 UTC | |
by Oberon (Monk) on Jun 13, 2003 at 18:52 UTC |