The hints how to make an in_array() function are already in the various answers. This just puts them together
usage: in_array($needle,@haystack)
returns: 0 if not found and the number of instances found otherwise
sub in_array { my $value = shift(@_) ; my @array = @_ ; return scalar(grep({$_ eq $value} @array)) ; }
In reply to Re: in_array and skipping foreach
by crashulater
in thread in_array and skipping foreach
by webchalkboard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |