Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 pondering the Monastery: (5)
As of 2016-08-27 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (378 votes). Check out past polls.