You might want to look into using DB_File -- your hash will use your disk
as a sort of 'virtual memory', plus your hash will be persistent between
calls of your script:
use DB_File;
tie %myhash, "DB_File", $filename or die "Can't open $filename$!\n";
#do stuff to gather data
$myhash{$somekey} = $somevalue;
#do more stuff with your data
untie %myhash;
I like this idea!
use MLDBM 'DB_File';
tie (%myhash, 'MLDBM', [other args]) or die "...";
$myhash{$somekey} = ["some data", "more data"];
Be very careful, though, because you can't do:
$myhash{$somekey}->[0] = "even more data";
This is a limitation of the hash interface (you can't manipulate data via
references on the disk). Instead, use temp variables:
$moredata = $myhash{$somekey};
$moredata->[0] = "even more data";
$myhash{$somekey} = $moredata;
I say:
Cool, but maybe it's time to consider another approach all together!