http://qs321.pair.com?node_id=210511


in reply to Efficient memory

I agree with rdfield and think that it would be worthwhile to give Storable a try. Why? because it is simple, faster than MLDBM, and you could probably write/test throwaway scripts in less than 15 minutes:
use strict; use warnings; use Storable qw(nstore); my %data; ## sub that loads hash GetData('data.txt', \%data); ## store to disk nstore (\%data, "data.nstore");
To retrieve:
use strict; use warnings; use Storable qw(retrieve); my %data = %{ retrieve("data.nstore") };
I use storable on data structures of the form data{a}{b}{c} for employee records. The flat text file is 1.5MB (5000 records), the nstored version is 3.5MB and it takes less than 2 seconds to store or retrieve. Try it and decide for yourself.

--Jim