if (grep $_ == $x, @array) { print "Found $x in the array!\n"; } #### if (grep /^$x$/, @array){ ... }