in reply to problem in sorting hash by value

well it turns out that the following works: replace the foreach line above with
foreach $key (sort {$thishash{b}<=>$thishash{a} } keys %thishash)
now the question is: why wasn't the sub by_nhits working before?

Replies are listed 'Best First'.
Re: Re: problem in sorting has by value
by chip (Curate) on Dec 11, 2001 at 06:59 UTC
    Um, wouldn't that be $a and $b as keys instead of just a and b?

        -- Chip Salzenberg, Free-Floating Agent of Chaos