in reply to check if a number is in a list

You almost got it. Use "==" (not "=") for number comparisons:
if (grep $_ == $x, @array) { print "Found $x in the array!\n"; }
... or, if you like the regular expression, just anchor it:
if (grep /^$x$/, @array){ ... }