http://qs321.pair.com?node_id=11112517


in reply to Re: Iterating over an hash while removing keys
in thread Iterating over an hash while removing keys

That is certainly what I would do in this case. And, if the size of the list becomes a problem, just have it break out of the first loop, get rid of the keys it's found so far, and start over.