use GDBM_File; use MLDBM qw(GDBM_File Storable); use Thing; ## (Thing is a package) tie (my %hash_db, "MLDBM", 'output.db', &GDBM_WRCREAT, 0606); foreach my $key (keys %hash_db) { my $current_thing = $hash_db{$key}; ## do something with current_thing $hash_db{$key} = $current_thing; } untie %hash_db;