perl array of array of hashes sorting
- by srk
@aoaoh;
$aoaoh[0][0]{21} = 31;
$aoaoh[0][0]{22} = 31;
$aoaoh[0][0]{23} = 17;
for $k(0.. $#aoaoh) {
for $i(0.. $#aoaoh) {
for $val (keys %{$aoaoh[$i][$k]}) {
print "$val=$aoaoh[$i][$k]{$val}";
print "\n";
}}
}
output is
22=31
21=31
23=17
but i expect it to be
21=31
22=31
23=17
Please tell me where is this wrong..
Also how do i sort the values so that i get the output as
23=17
22=31
21=31 (if 2 keys have same value then key with higher value come first)