my @ptests = (88,89,90,91,110,115); if ( grep {$p == $_} @ptests ) { return $p; } #### use List::MoreUtils qw {firstval}; my @ptests = (88,89,90,91,110,115); if ( firstval {$p == $_} @ptests) { return $p; }