in reply to Re: sorting hashes by value
in thread sorting hashes by value

To print the values with the words...would it be...
@keysorted = sort {$word_list{$b} <=> $word_list{$a}} keys %word_list; for $i (0..$#keysorted){ for $word(keys %{$keysorted[$i]}){ pritn "$word = $keys[$i]{word}\n";

Replies are listed 'Best First'.
Re: Re: Re: sorting hashes by value
by FamousLongAgo (Friar) on Nov 08, 2002 at 22:32 UTC
    There's an easier way to do it:
    foreach my $key ( sort { $word_list{$b} <=> $word_list{$a} } keys %word_list ) { print $key, " ", $word_list{$key}, "\n"; }