If you want the whole hash in a file, quick and don't mind if the output file's readable text format, I'm currently in love with the Storable module. Just use "store" and the filename you wanna put it in, and "retrieve" to get it back.
Comment on Re: storing a huge text file into a hash