in reply to Re: with tied hash, 'each' gives key that doesn't 'exists'
in thread with tied hash, 'each' gives key that doesn't 'exists'
FYI, keys would be very inappropriate in this case, because it would read the file twice ... build a complete list of the record keys in RAM (virtual memory) ... then retrieve the records by those keys. Most of the time you would run out of RAM. But even if you didn’t, you’d be doing a rather massively too-much amount of unnecessary work.
each, on the other hand, simply walks through the file. There is no memory-footprint to speak of. Furthermore, it always does so in ascending order by key. Very often, that is exactly what you want. (What bearing if any this may have on this issue, I don’t know.)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: with tied hash, 'each' gives key that doesn't 'exists'
by cmac (Monk) on Sep 18, 2010 at 06:18 UTC |