in reply to Returning indices with same values for array within hash.
Deferencing the array reference that's the value associated with the hash key "NI" will get you there:
use strict; use warnings; use List::Util qw/min/; my %matrix = ( NI => [ 1, 1, 3, 4 ] ); my @NI_index = grep { $matrix{NI}->[$_] == min @{ $matrix{NI} } } 0 .. + $#{ $matrix{NI} }; print "@NI_index";
Output:
0 1
Hope this helps!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Returning indices with same values for array within hash.
by LanX (Saint) on Nov 10, 2013 at 15:55 UTC | |
by Kenosis (Priest) on Nov 10, 2013 at 16:51 UTC |