in reply to sub fails second time called

jdagius,
(yes, I know about List::Member, but it won't find 0 (zero) in a list, (bug?)

Yes, there is a bug and you should file a bug. Be sure to CC the author because not all CPAN authors look at their RT queue.

The issue is from this line in the source:

my $target = shift or Carp::croak "No target in member/2 ";
It assumes that $target will be true - which rules out '', "0", 0, etc. That sub would probably be better written as:
sub member { my ($target, @list) = @_; Carp::croak "No target in member/2 " if ! @list; if (defined $target) { for (0 .. $#list) { return $_ if $list[$_] eq $target; } return $NEG; } else { for (0 .. $#item) { return $_ if ! defined $item[$_]; } return $NEG; } }

It would also be nice if the documentation explicitly reminded the user that since it returns the index (first item = 0), member() should not be used as a boolean.

With regards to your original question - see Getting Matching Items From An Array.

Cheers - L~R