thillai_selvan has asked for the wisdom of the Perl Monks concerning the following question:
Here I want to sort the hash elements based on their values. So I want the output to be like thisuse strict; use warnings; my @aoh =( { 3 => 15, 4 => 8, 5 => 9, }, { 3 => 11, 4 => 25, 5 => 6, }, { 3 => 5, 4 => 18, 5 => 5, }, { 0 => 16, 1 => 11, 2 => 7, }, { 0 => 21, 1 => 13, 2 => 31, }, { 0 => 11, 1 => 14, 2 => 31, }, );
How can I achieve this? Any help much appreciated...@aoh =( { 4 => 8, 5 => 9, 3 => 15, }, { 5 => 6, 3 => 11, 4 => 25, }, { 5 => 5, 3 => 5, 4 => 18, }, { 2 => 7, 1 => 11, 0 => 16, }, { 1 => 13, 0 => 21, 2 => 31, }, { 0 => 11, 1 => 14, 2 => 31, }, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array of hash sorting problem
by Corion (Patriarch) on Mar 25, 2010 at 09:50 UTC | |
by thillai_selvan (Initiate) on Mar 25, 2010 at 09:56 UTC | |
by Corion (Patriarch) on Mar 25, 2010 at 10:10 UTC | |
by Marshall (Canon) on Mar 25, 2010 at 10:15 UTC | |
|
Re: Array of hash sorting problem
by moritz (Cardinal) on Mar 25, 2010 at 10:32 UTC | |
by 7stud (Deacon) on Mar 25, 2010 at 17:17 UTC | |
by Anonymous Monk on Mar 26, 2010 at 04:32 UTC | |
|
Re: Array of hash sorting problem
by almut (Canon) on Mar 25, 2010 at 10:11 UTC | |
by murugaperumal (Sexton) on Mar 25, 2010 at 10:19 UTC | |
by almut (Canon) on Mar 25, 2010 at 10:51 UTC | |
by pavunkumar (Scribe) on Mar 25, 2010 at 10:25 UTC |