Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Getting indices of the same value that occurs multiple times in an array...

by moritz (Cardinal)
on Aug 04, 2011 at 11:39 UTC ( #918509=note: print w/ replies, xml ) Need Help??


in reply to Getting indices of the same value that occurs multiple times in an array...

Try something like

my @indexes = grep { $a[$_] eq $search_for } 0..$#a; $participants{$og} = \@indexes;

This puts an array reference of all found indexes into the hash. See perlreftut for more information about references, and why you need them here.


Comment on Re: Getting indices of the same value that occurs multiple times in an array...
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-07-12 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls