while() { ($keys, $date, $token, $server, $hour, $peak)= split; @th = $date; #$res{$key}{$server}->{REGION}++; #$res{$key}{$user}->{QUANTITY}++; if ($keys eq $filename){ switch($filename){ case "USA" {$res{$keys}{$date}->{DATE};$res{DATE}{$hour}->{PEAK}+=$peak;$flag=1} case "EUROPE" {$res{$date}{$hour}->{PEAK}+=$peak;$flag=1} else { print "previous case not true" } } } } if ($flag){ pgm_fil(); } my $tablecontent; sub pgm_fil{ my $q = new CGI; $q->header; $q->start_html(); print ""; my $tablecontent=[$q->th(['Date/Hours', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'])]; print ""; foreach $datea(@th){ print ""; } foreach my $key (sort {$a<=>$b} keys %res){ foreach my $user (keys %{$res{$key}}){ foreach my $user1 (keys %{$res{$key}{$user}}){ my @hashval = $res{$key}{$user}{$user1}; foreach my $hashval( @hashval){ print ""; push @$tablecontent,$q->td([$date,$hashval[$_] ]); } } } } print "
Date/Hours$datea
$user$hashval[$_]
"; print $q->table( { border => 1, -width => '50%', -align=>'left'}, $q->Tr( $tablecontent), ); }