in reply to Re: Array of Hashes and sorting by values
in thread Array of Hashes and sorting by values
Thank you for your answer.
Following that I tried the following code:
sub par_num { return $a <=> $b } $old[0]{jure} = 1; $old[1]{juge} = 1; $old[2]{pupe} = 3; $old[3]{mupe} = 2; @tri = sort par_num @old; @old = @tri; for $i ( 0 .. $#old ) { print "$i is { "; for $mot ( keys %{ $old[$i] } ) { print "$mot=$old[$i]{$mot} "; } print "}\n"; }
It works well on simple array but not on array of hashes
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Array of Hashes and sorting by values
by Corion (Patriarch) on Jan 17, 2011 at 20:20 UTC | |
by pandelis (Initiate) on Jan 18, 2011 at 07:42 UTC |