sub in_array {return scalar grep{/^@{[pop]}$/}@_}

Replies are listed 'Best First'.
Re: simple utility method
by ikegami (Patriarch) on Feb 15, 2008 at 18:15 UTC
    Three bugs. It doesn't convert the strings to regexps (\Q..\E), it assumes $ means end-of-string (\z), and it just plain doesn't work. Try
    print in_array('a', 'b', 'c'); # 1 (b)