pzj20012 has asked for the wisdom of the Perl Monks concerning the following question:
Previously I was using the following:
This returns indices: "0 1"my @NI = (1 ,1 ,3 ,4); my @NI_index = grep { $NI[$_] == min @NI } 0 .. $#NI; print "@NI_index";
Let's say now I want to put the array NI in a hash instead:
How do you get the same output into @NI_index by modifying this line? Or is there another way to do it?my %matrix = (NI => [1 ,1 ,3 ,4] );
my @NI_index = grep { $NI[$_] == min @NI } 0 .. $#NI;
Thank you very much!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning indices with same values for array within hash.
by johngg (Canon) on Nov 10, 2013 at 15:48 UTC | |
|
Re: Returning indices with same values for array within hash.
by Kenosis (Priest) on Nov 10, 2013 at 15:28 UTC | |
by LanX (Saint) on Nov 10, 2013 at 15:55 UTC | |
by Kenosis (Priest) on Nov 10, 2013 at 16:51 UTC | |
|
Re: Returning indices with same values for array within hash.
by Athanasius (Archbishop) on Nov 10, 2013 at 15:58 UTC | |
|
Re: Returning indices with same values for array within hash.
by AnomalousMonk (Archbishop) on Nov 10, 2013 at 17:00 UTC | |
|
Re: Returning indices with same values for array within hash.
by hdb (Monsignor) on Nov 11, 2013 at 09:30 UTC | |
by AnomalousMonk (Archbishop) on Nov 11, 2013 at 17:12 UTC |