Mes freres,
The subs bellow are from an Excel parsing script which displays the data in a variety of ways. One display set is a series of 8 tables which have similar columns but vary arbitrarily as to how many cells in a row have data. I am wondering if someone sees a more elegant solution. The code is already in production but I would like it to be as elegant and efficient as possible as it is on a slow IIs box. My initial thought is to try to unify the row_making subs into one that accepts as args the rows it will spit out. Like so make_rows(3,1,3); to make 3 rows with three, one, and three data cells per row, but maybe someone sees a fancy use for map or something more elegant?
TIA
jg
sub by_parish { print $q->header,start_html( {-title=>"Kids Count Data for $choice +$headline"}) , div({-align=>"center"}, $top, h2({-align=>"CENTER"},"Data for $choice$headline"), hr({ +-width=>"400"}), ), #div p( b($t[$k++]),br, ##iterate thru @ of table names table( {-width=>'600',-border=>'1'}, ##Population (1997) @toprow, parishdata_x3(),parishdata_x3(),parishdata_x1(), ##call t +he subs to print either 3 data cells or 1 ), #table ), #p p( b($t[$k++]),br, table( {-width=>'600',-border=>'1'}, ##Poverty (1995) @toprow, parishdata_x1(),parishdata_x1(), ), #table .... #and so on sub parishdata_x3 { Tr({-align=>"right"}, td( {-align=>"center"}, b($r[$j++]), ), #iterate thru @ of row la +bels td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), #iterate thru + alpha sorted hash from excel file td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), ); } sub parishdata_x1 { Tr({-align=>"right"}, td( {-align=>"center"}, b($r[$j++]), ), td( {-bgcolor=>"$data"}, " "), td( {-bgcolor=>"$data"}, " "), td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), ); }
_____________________________________________________
Think a race on a horse on a ball with a fish! TG

In reply to Style Questions For Elegant Printing of Tables by jerrygarciuh

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.