in reply to sort HoH by second level values in specific order
1. Well the usual structure for a sorted table is a AoH .
@space = ( { node => 1 , "cores" => 12, "memory" => 200 }, { node => 2 , "cores" => 12, "memory" => 500 }, ... )
2. The sort manual describes how to sort for 2 values with an or- combination
my @new = sort { ($b =~ /=(\d+)/)[0] <=> ($a =~ /=(\d+)/)[0] || fc($a) cmp fc($b) } @old;
Maybe try to combine this and show us what you tried. :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sort HoH by second level values in specific order
by lener (Initiate) on Dec 15, 2017 at 17:52 UTC |