NAME
List::Member - PROLOG's member/2: return index of $x in @y.
SYNOPSIS
use List::Member;
my $target = 'bar';
my @look_in = ('foo','baz','bar','etc');
warn "It's a member of the array"
if member('bar',@look_in) +1;
warn "It's a member of the array"
if member('bar',@look_in) >= 0;
__END__;
DESCRIPTION
A tiny routine to achieve the same effect as PROLOG's member/2
.
Returns the index of supplied scalar in supplied array, or returns the value of the package's $NEG
scalar. This can be over-riden for the case when the target is the same as the default -1
.
EXPORT
member
THANKS
Thanks to Benoit Thillaye du Boulay in France for pointing
out a bug in the documentation.
AUTHOR
Lee Goddard <lgoddard@cpan.org>
SEE ALSO
perl(1).