Here is what I would do (save you a loop).
my %og_to_gid; foreach (@COUNT) { my @a = split /\s+/; my $og = $a[0]; my $search_for = "1"; my @indices = grep { $a[$_] eq $search_for } 0..$#a; $og_to_gid{$og} = join ' ', map { $families[$_] } @indices; }
In reply to Re: Getting indices of the same value that occurs multiple times in an array...
by thenaz
in thread Getting indices of the same value that occurs multiple times in an array...
by reubs85
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |