while (my ($k,$v) = first %hash) { delete $hash{$_} for $k, @$v; }