Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: in_array and skipping foreach

by crashulater (Initiate)
on Jan 16, 2020 at 16:21 UTC ( [id://11111493]=note: print w/replies, xml ) Need Help??


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)) ; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11111493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-18 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found