G'day vkknava,

The first thing you need to do is read Perl Introduction for Beginners.

Now that you've (hopefully) read that, let's go through your code line-by-line.

while(<DATA>)
There's no __DATA__ token. Perhaps you're using the "Input File" you posted.
($keys, $date, $token, $server, $hour, $peak)= split;
That doesn't match your "Input File". 3rd column is "Hour" vs. 5th field is $hour. "Input File" has 5 fields; you're splitting $_ into 6 fields.
@th = $date;
You probably want: push @th, $date;
if ($keys eq $filename)
You don't initialise $filename anywhere in your code. Perhaps you meant: if (! defined $keys)
switch ... case ... case ... else
What language is this? You appear to be just inventing new syntax!
$res{$keys}{$date}->{DATE}
$res{DATE}{$hour}->{PEAK}
$res{$date}{$hour}->{PEAK}
You haven't defined %res anywhere in your code. Why the "->" between the 2nd and 3rd keys? You don't have "->" between the 1st and 2nd keys. Did you think it was doing something special in that position?

I'm going to stop there. You have problems on every single line of code so far. Fix what I've pointed out. Fix the problems Perl tells you about (from the strict and warnings pragmata you'll be adding to your code). You'll also want to move that subroutine definition out of the while loop!

If you need further help, please ensure you have read, and followed, the guidelines in "How do I post a question effectively?" before posting.

-- Ken


In reply to Re: Perl help with html cgi table by kcott
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.