in reply to grep { $var } @arr
Its code, so put it into a function. grep allows replacing the EXPR with a function call and $_ is global anyway. :)
Cheers Rolf
(addicted to the Perl Programming Language)