doran has asked for the wisdom of the Perl Monks concerning the following question:
which produces a data structure similar to this:while (my $d = $ks_sth->fetchrow_hashref()){ $KP->{$d->{k}}{$d->{v}}++; }
What's an efficient way to find the x (say, top 3) highest values in the "rightmost" numbers?$VAR1 = { '3094507' => { '2838413' => '22', '2976790' => '33', '539960' => '10', '2152725' => '19', '161546' => '5', '2197572' => '3' }, '2946464' => { '2952428' => '9', '3913125' => '10', '790014' => '2', '1065575' => '3' }, '2565888' => { '10538' => '1', '744' => '2' }, };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting values of nested hash refs
by tinita (Parson) on Feb 29, 2004 at 12:56 UTC | |
|
Re: Sorting values of nested hash refs
by neniro (Priest) on Feb 29, 2004 at 12:06 UTC | |
by Limbic~Region (Chancellor) on Feb 29, 2004 at 13:25 UTC | |
by doran (Deacon) on Mar 01, 2004 at 07:06 UTC | |
by Limbic~Region (Chancellor) on Mar 01, 2004 at 14:40 UTC | |
by doran (Deacon) on Mar 01, 2004 at 06:31 UTC | |
|
Re: Sorting values of nested hash refs
by ambrus (Abbot) on Feb 29, 2004 at 19:48 UTC | |
by doran (Deacon) on Feb 29, 2004 at 23:12 UTC | |
by ambrus (Abbot) on Mar 02, 2004 at 21:36 UTC | |
by ambrus (Abbot) on Mar 04, 2004 at 13:43 UTC |