in reply to performing operation on elements not in list?
my %hash = (one => 1, two => 1, three => 1); my %keep; @keep{ qw(two three) } = (); map { exists($keep{$_}) or $hash{$_} = 0 } keys(%hash); [download]