I have to run off to work in the lab, but here is some snippets from some cgi stuff I use. It is from a book by Lincoln Stein called "Official Guide to Programing with CGI.pm " and has been a handy book. In this example, it goes through some hashes and creates a first entry of a link, then puts other values from the hashes into a list. then the list with a td header is pushed onto a list called @rows. The last line of the table creates the table rows including the column header. I tried looking for examples in perldoc CGI but didn't find it in there.
#!/usr/bin/perl use CGI ':standard',':html3'; foreach $key(sort(keys %ph_isv)){ $key_link = '<a href=../cgi-bin/partgraph?part='.$key.'>'.$key.'</ +a>'; @data = ($key_link,$ph_isv{$key},$ph_oos{$key},$aa_inprg{$key},$aa +_hand{$key},$aa_redir{$key},); push @rows,td(\@data); } @col_head = ('Partition', 'In Service','Out of Service','In Progress', + 'Handled', 'Redirected'); print table({-border=>'', -align=>CENTER}, caption(strong($caption)), TR(td({-colspan=>1},[' ']),td({-colspan=>2, -align=>CENTER},[ +'<b>Phones</b>']),td({-colspan=>3, -align=>CENTER},[ '<b>Auto Attenda +nt</b>'])), TR([th(\@col_head),@rows]) ) ;

In reply to Re: CGI table rows from an array by odha57
in thread CGI table rows from an array by Melly

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.