#!/usr/pkg/bin/perl -w unlink("revmap_check_deleteme"); $myhashinfo=new DB_File::HASHINFO; $myhashinfo->{bsize}=8192; # The amount of data I intend to store is quite large. I # had to increase the bsize as a result.. tie(%revmap, "DB_File", "revmap_check_deleteme", O_CREAT|O_RDWR, 0666, $myhashinfo) or die "Unable to create database tie.\n"; # So here we create duplicate values for every item in # the memory hash. for ($counter=0; $counter<10; $counter++) { push @{$memrevmap{$counter}}, "somefile$counter"; push @{$memrevmap{$counter}}, "somefile$counter"; } # Now, here's my (lame) attempt to copy the normal hash to # the tie'd disk hash. foreach $key (keys %memrevmap) { foreach $val (@{$memrevmap{$key}}) { print "pushing into $key, $val\n"; @{$revmap{$key}}=(@{$revmap{$key}}, $val); } } # And here's my attempt to verify that the values were # in fact written to disk. If I change the item below to # memrevmap, it works. foreach $key (keys %revmap) { print "key = $key\n"; print "Data values: "; foreach $val (@{$revmap{$key}}) { print "subval: $val\n"; } } untie %revmap; print "Done.";