in reply to Re^4: What is the easiest way to merge two hashes?
in thread What is the easiest way to merge two hashes?

In the more complex case, you need to exactly specify what you want to happen. You might specify for two identical keys that both point to hash refs you want to recursively apply the procedure. But what will happen if in one hash the common key points to a scalar and in the other to a hash ref. Or if there are array refs containing hash refs, etc? Can these complexities be ruled out?

  • Comment on Re^5: What is the easiest way to merge two hashes?

Replies are listed 'Best First'.
Re^6: What is the easiest way to merge two hashes?
by tkguifan (Scribe) on Feb 15, 2015 at 08:57 UTC
    They values are guaranteed to be of the same type, wherever a collision can happen ( namely scalar ). This is specific to my problem, so I need not worry about different types. Both hashes have the same structure, just here and there some values are missing from one or the other. If there is a collision the value to overwrite is always a scalar.