in reply to sort question

my @array = sort { $entry{$table}{$a}{RANK} cmp $entry{$table}{$b}{RANK} } keys %{$entry{$table}};

Explanation of the code is left as an exercise for the reader.


  • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
  • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"

Replies are listed 'Best First'.
Re^2: sort question
by salva (Canon) on May 18, 2005 at 07:54 UTC
    or much faster...
    use Sort::Key qw(nkeysort); my @array = nkeysort { $entry{$table}{$_}{RANK} } keys %{$entry{$table}};