Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 meditating upon the Monastery: (8)
As of 2014-12-19 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (81 votes), past polls