Hi,

Thanks for the response. I am beginner, so very little knowledge of the advanced stuffs to reduce the coding complexity. May be the below code will give a better picture.

my $filename = param('textcontent'); print "<br><br><br>"; print "The Location you have selected is: $filename"; print "<br><br><br>"; my $k; my $i=0;my $file;my @argv;my %res;my $key;my $date, my +$token, my $server, my $hour, my $peak;my $flag = 0;my $tablecontent; +my @th; open(DATA, "../cgi-bin/lic.txt") || die("Could not open file!" +); while(<DATA>) { ($key, $date, $token, $server, $hour, $peak)= split; if ($key eq $filename){ switch($filename){ case "EMEA" {$res{$date}{$hour}->{PEAK}+=$peak;$fl +ag=1} case "APAC" {$res{$date}{$hour}->{PEAK}+=$peak;$fl +ag=1} else { print "previous case not true" } } } } if ($flag){ pgm_fil(); } sub pgm_fil{ my $q = new CGI; $q->header; $q->start_html(); my $tablecontent=[$q->th(['Date/Hours','00', '01', '02', ' +03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14' +, '15', '16', '17', '18', '19', '20', '21', '22', '23'])]; foreach my $key (sort {$a<=>$b} keys %res){ foreach my $user (keys %{$res{$key}}){ foreach my $user1 (keys %{$res{$key}{$user}}){ push @$tablecontent,$q->td([$key,$res{$key}{$u +ser}{$user1}]); } } } print $q->table( { border => 1, -width => '50%', -align=>' +left'}, $q->Tr( $tablecontent), ); }

In reply to Re^2: Perl help with html cgi table by vkknava
in thread Perl help with html cgi table by vkknava

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.