while (my ($key, $val) = each %hash) { delete $hash{$key}; printf "%s => %s is gone.\n", $key, $val; }