in reply to Best method to order a hash of arrays
and<code> # code => [ 'label', 'order' ] %user_types =( 037 => [ 'member', '1' ], 165 => [ 'public', '2' ], 022 => [ 'staff', '3' ], 683 => [ 'babe', '4' ], 001 => [ 'old fart', '5' ] );
It's simple & readable@types_sorted = sort { $user_types{$a}[1] <=> $user_types{$b}[1] } ke +ys %user_types; for $i (0 .. $#types_sorted) { make options list; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best method to order a hash of arrays
by jdporter (Paladin) on May 15, 2007 at 21:55 UTC | |
by kyle (Abbot) on May 16, 2007 at 02:43 UTC |