in reply to delete hash key while hash in use

Your question is addressed here: Deleting Hash Entries while Iterating

However, as GrandFather said, perhaps you should tell us more about the problem behind your question; it may be an XY Problem.

HTH,

planetscape