|Problems? Is your data what you think it is?|
Getting indices of the same value that occurs multiple times in an array...by reubs85 (Acolyte)
|on Aug 04, 2011 at 11:27 UTC||Need Help??|
reubs85 has asked for the
wisdom of the Perl Monks concerning the following question:
Could I pick your brains regarding some array wrangling?
I have an input file that looks something like:
and I would like to know, for each family, which two members are '1', possibly storing them as a hash in which the key = family (eg OG_1) and the value = 'lacM mori' or something similar...
I am able to manipulate this such that I can get the name of the first incidence of '1', by using (the input file has been read into the array @COUNT):
which gives, within the %og_to_gid hash, a result whereby the key = OG_1 and the value = lacM, in this case (sorry about the weird variable names; I'm a genome biologist (and genome biologists are weird anyway)), which was fine for a previous script but now I really need to know the names of BOTH the members for each family.
Any ideas would be most welcome! Is there something within for example List::Utils that could do it? I had a look but I couldn't see anything...
Thanks once again,