mielstogo has asked for the wisdom of the Perl Monks concerning the following question:
Current problem HOH I need to sort:example of a previous sort: foreach $sym (sort {$pid_PFAULT{$pid}{$b} <=> $pid_PFAULT{$pid} +{$a}} (keys %{$pid_PFAULT{$pid}})) (and the above required I be inside a loop knowing the $pid value)
Sample data: (where VAR1=$rip, VAR2=$pid 'cnt' => 1) ('cnt' is integer from 1>n)# text report by remoteIP:port sub text_sock_report_byrip() { my $pid, my $avg, my $rip, my $type, my $cmd; for $rip (keys %sock_total) { print "Report on remote host: $rip\n"; for $pid (keys %{$sock_total{$rip}}) { printf("pid: %s\n",$pid); for $type (keys %{$sock_total{$rip}{$pid}}) { printf("\t%s, ",$type); printf("\tcnt: %8d, ",$sock_total{$rip}{$pid}{$type}{'cnt'}); $avg = $sock_total{$rip}{$pid}{$type}{'tot'} / $sock_total{$rip}{$pid}{$type}{'cnt'}; printf("\tavg: %12.6f, ",$avg); printf("\tmin: %12.6f, ",$sock_total{$rip}{$pid}{$type}{'min'}); printf("\tmax: %12.6f\n",$sock_total{$rip}{$pid}{$type}{'max'}); } } } }
VAR1 = 'R=10.10.0.111:54998'; $VAR2 = { '12913' => { 'write' => { 'tot' => '2.3e-05', 'min' => '0.000023', 'max' => '0.000023', 'cnt' => 1 } } }; $VAR3 = 'R=10.10.1.110:57354'; $VAR4 = { '12913' => { 'read' => { 'tot' => '1.5e-05', ..... etc....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trouble sorting a nested HOH
by graff (Chancellor) on Nov 28, 2007 at 02:35 UTC | |
by mielstogo (Initiate) on Nov 28, 2007 at 04:55 UTC | |
by mielstogo (Initiate) on Nov 28, 2007 at 05:07 UTC | |
|
Re: Trouble sorting a nested HOH
by chrism01 (Friar) on Nov 28, 2007 at 06:51 UTC | |
by mielstogo (Initiate) on Nov 28, 2007 at 21:12 UTC |