How can I sort a Perl array of array of hashes?
        Posted  
        
            by srk
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by srk
        
        
        
        Published on 2010-03-24T18:16:47Z
        Indexed on 
            2010/03/24
            23:33 UTC
        
        
        Read the original article
        Hit count: 358
        
@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}\n";
        }
    }
}
The 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)
        © Stack Overflow or respective owner