my %valid_params; undef @valid_params{qw(foo bar)}; ... (defined $entry and exists $valid_params{$entry}) ...