Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Finding the index of a specific element in an array.

by toolic (Bishop)
on Jan 24, 2012 at 21:08 UTC ( [id://949760]=note: print w/replies, xml ) Need Help??


in reply to Finding the index of a specific element in an array.

One way is to use List::MoreUtils:
use warnings; use strict; use List::MoreUtils qw(firstidx); my @array = (2,4,7,5,8); printf "item with index %i in list is 7\n", firstidx { $_ == 7 } @arra +y; __END__ item with index 2 in list is 7

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found