good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Re^3: map-like hash iteratorby jdporter (Paladin) |
on Nov 06, 2002 at 21:32 UTC ( [id://210918]=note: print w/replies, xml ) | Need Help?? |
Of course, if you're not in void context and actually intent on returning the resulting list from processing a 10,000,000 key hash, you'll have to be able to fit that in memory anyway.Not necessarily always the case, though. The callback routine might never return anything -- except one time when it returns one thing. A jillion-key hash in, a one-element list out. Just like map.
You can't have your cake and eat it - you can't be using an iterator when you're concerned about memory usage.That is patently false. In fact, the built-in hash iterator (each) is all about efficiency -- in both space and time. There is no reason why iterators can't be efficient.
In Section
Cool Uses for Perl
|
|