in reply to Re: Re: Re: Sorting by the value of the inner hash
in thread Sorting by the value of the inner hash

1. I answered your second point in my reply to matija
2. The input is a huge hash (HOH) table with the same data distribution you can see in the results table(second point).
3. The code I provided is an excerpt of a whole program, and the only thing is missig is the sorting. I am using strict and warnings.
4. I really don't know what else you need unless you want the whole program that is more than 6 pages
Thanks
  • Comment on Re: Re: Re: Re: Sorting by the value of the inner hash

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Sorting by the value of the inner hash
by DamnDirtyApe (Curate) on Mar 31, 2004 at 08:37 UTC

    Give this a shot:

    #! /usr/bin/perl use strict; *OUT = *STDOUT; my %totalscoreinv; $totalscoreinv{700200} = { 523246 => -438.024029240629, 523247 => -470.547762535975, 523237 => -494.393864137596, 523261 => -509.711586526694, 523424 => -521.488541326437 }; foreach my $keyscore (keys %totalscoreinv) { print OUT "\n\nFirst key:$keyscore\n"; foreach my $keyscore2 ( sort {$totalscoreinv{$keyscore}{$b} <=> $totalscoreinv{$keyscore}{$a}} keys %{$totalscoreinv{$keyscore}} ) { printf OUT "%30s %s\n", "$keyscore2= ", $totalscoreinv{$keyscore}{$keyscore2}; } }

    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche