my %valid = map { $_ => 1 } qw( this that another ); $broken->{$_} = 1 for grep $valid{$_}, @list;