foreach my $key (keys %hash_db) # creates a list in memory # containing all key strings # vs. while ( my ($key, $val) = each %hash_db ) # iterates over the DB entries one at a time # and doesn't hold all keys in memory at once