Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

(dkubb) Re: (2) Idiomatic Array Index Search?

by dkubb (Deacon)
on May 27, 2001 at 12:35 UTC ( [id://83581]=note: print w/replies, xml ) Need Help??


in reply to Idiomatic Array Index Search?

I agree with japhy on this one, simple things should be kept simple. Here is a variation on his get_index routine that combines his routine with other idioms mentioned in this node:

my $index = get_index(\@array, $element); sub get_index { my ($a, $e) = @_; $e eq $a->[$_] and return $_ for 0..$#$a; return -1; }

Log In?
Username:
Password:

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

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

    No recent polls found