If you are concerned about size and memory consumption then I'd suggest looking at
. You can then tie your hash to the disk. However, you have shifted your memory problems to disk problems. But generally speaking HDD space is cheaper than memory space.
However, as has been mentioned above, Perl can handle very large sets of data quite easily.