Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Finding index of an entry in an Array

by Anonymous Monk
on Dec 07, 2007 at 16:33 UTC ( [id://655688]=note: print w/replies, xml ) Need Help??


in reply to Finding index of an entry in an Array

a caching approach to returning all indices of an item in an array:

perl -wMstrict -e "my @repo = qw(foo bar qux bar bar zot); my %repo_indices; push @{ $repo_indices{$repo[$_]} }, $_ for 0 .. $#repo; print qq(@{ $repo_indices{bar} });" 1 3 4

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found