If your datastructure is a simple key-value hash (i.e. not a hash containing arrayrefs, hashref, etc), you could tie your hash to a DBM file to write directly to the disk. This way your memory usage would be minimal.
For more complex structures (constaining refs)
you can play with MLDBM
It uses Data::Dumper by default to serialize your data,
but you can use your favourite persistence module instead, like Storable for example...