in reply to Re: looking for simple way to check scalar against array
in thread looking for simple way to check scalar against array

Why use a regexp? It's inefficient, and that particular regexp will fail if 1) $i contains special characters, and 2) if $i is part of another number (e.g. when $i=1 and list=(2..10), your regexp will match).

print if /^\Q$i\E$/ would fix the problem.
print if $_ eq $i is equivalent, but much more efficient.
print if $_ == $i would be even more efficient given that we're dealing with numbers here.