in reply to Is list member

Silly me, it's obvious how to do that, I'v just changed it too:
sub isListMember { my ($array, $item) = @_; # array ref, item for (@{$array}) { if (/^\d+$/) { return $TRUE if ($_ == $item); } else { return $TRUE if ($_ eq $item); } } $return $FALSE; }
Is that the right way, or there's a better or correct one?

Thanks.

Hotshot

Replies are listed 'Best First'.
Re: Re: Is list member
by davorg (Chancellor) on May 06, 2002 at 09:19 UTC

    You realise that this only works for integers?

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg