my @taxR = ("PLRV1", "PMTVS", "PVXHB"); # Copy the array into a hash. # Make sure you only do this once. my %taxR = map {$_ => 1} @taxR; my $curEntry = "PMTVS"; if (exists $taxR{$curEntry}) { print "do rest of stuff"; }