my @stuff = qw/a b c d/; my %nums = ( a => 1, b => 2, c => 3, ); if (exists $nums{$stuff[0]}) { print "$stuff[0] is in \%nums"; ) }