use warnings; use strict; my @taxR = ("PLRV1", "PMTVS", "PVXHB"); my %taxRh = map { $_ => 1 } @taxR; my $curEntry = "PMTVS"; if (exists $taxRh{$curEntry}) { print "do rest of stuff"; }