What they already said except that since you're not actually using regex, you shouldn't use regex. This will be faster and have fewer caveats (I inverted the statement as a matter of stylistic preference, not because it's necessary)–
print "Found it.\n" if grep { $_ eq $value } @array;In reply to Re^2: How to check whether my array contains element x
by Your Mother
in thread How to check whether my array contains element x
by sandeepda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |