This code iterates over the original set of hash keys:for my $key (my @temp = keys %my_hash)
I'm confused as to why you think that buys you anything over for my $key (keys %my_hash) which, afaik, will always iterate over the original set of keys as well. Keys added in the loop won't be iterated over because the keys() function is only called once and you are iterating over the list it returns. Right? (I'll be mighty embarrassed if not.) As for deletions, the temporary array doesn't help you there either; that's what exists() is for.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Iterating hashes safely and efficiently
by sauoq
in thread Iterating hashes safely and efficiently
by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |