in reply to Weird grep behaviour
if( grep(/$var1/, @arr1) )
or
if( grep {/$var1/} @arr1 )
or
if( grep { $_ eq $var1} @arr1 )
Your usage of grep evaluates $var1 for every instance of @arr1, then happily returns the element for which the evaluation of $var1 succeeded. See grep.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|