If all you need to do is save the hashes and then re-load them at a later time you can use the
module (which is a core module in recent perls) to serialize them and re-load them quickly and reliably. This is only really necessary if you end up re-writing the code to use the more modern style of 2D hash, because the hash you have there is really just a 1-dimensional hash with a key composed of multiple elements and the DBM modules should be able to store that just fine.