in reply to Re^4: Analytics on Hash Arrays
in thread Analytics on Hash Arrays

You were using the same variable $x for max and min, and never updating it, nor comparing with the current max value for a $server and $metric combination. I'm surprised either max or min was correct. I suggest an alternative approach.

while(<DATA>){ next unless /\w/; my($server,$datetime,$metric,$value) = (split)[0,1,2,3]; $value =~ s/,//g ; my $ddhh = substr $datetime,0,13; my $dd = substr $datetime,0,10; if (! defined($d{$dd }{$server}{$metric}{max})) { $d{$dd }{$server}{$metric}{max} = 0; $d{$dd }{$server}{$metric}{min} = 99999999; $h{$ddhh }{$server}{$metric}{max} = 0; $h{$ddhh }{$server}{$metric}{min} = 99999999; } $d{$dd }{$server}{$metric}{max} = $value if ($d{$dd }{$serve +r}{$metric}{max} < $value); $d{$dd }{$server}{$metric}{min} = $value if ($d{$dd }{$serve +r}{$metric}{min} > $value); $h{$ddhh }{$server}{$metric}{max} = $value if ($h{$ddhh }{$serve +r}{$metric}{max} < $value); $h{$ddhh }{$server}{$metric}{min} = $value if ($h{$ddhh }{$serve +r}{$metric}{min} > $value); $ser{$server} = 1; $met{$metric} = 1; }
Dum Spiro Spero