I have two simple hashes with several key=>value pairs. Now I want to remove all keys of %hash2 from %hash1 (if they also exist in %hash1, regardless if the values differ or not). Basically %hash1 should be left with only keys that don't exist in %hash2. %hash2 should not be modified itself.
Is there a more efficient way to do this other than a loop that goes through each key of %hash2 and removes it from %hash1 one at a time?