in reply to in_array and skipping foreach
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)) ; }
|
|---|