in reply to writing perl function like sql IN

if (grep $x == $_, 1, 3, 7) { ... }

Dave.

Replies are listed 'Best First'.
Re^2: writing perl function like sql IN
by eserte (Deacon) on Aug 31, 2004 at 13:39 UTC
    A slightly more efficient solution (see the discussion below) would use the standard List::Util::first function:
    if (defined first { $x == $_ } 1, 3, 7) { ... }
    Note that it is necessary to use defined(), as first() returns the first matching element (which may be zero), not a list.