This actually is a perl question, although it involves HTML, if I'm understanding the question correctly.

The problem is that the data is in a rather odd format (multiple hashes), and there's a need to get it out of those structures, and into an HTML table -- which can be a pain, given the order that it's necessary to emit an HTML table.

This can be done quite a few ways:

(all code untested as I don't have the original data structures, and I'm only writing this all because it's 5am, and I can't sleep)

Which would I use? Well, the first one's fastest to write, and it's easy to modify so you're emitting <th> as a replacement for <td> in the correct place ... you could loop over a list of strings to be 'eval'd for each iteration, if you wanted to remove redundancies ... but I'd probably look into what put the data in those original structures, and just modify it so it was placed into either an array of hashes, or hash of arrays to start with.


In reply to Re: For statement 2 html table by jhourcle
in thread For statement 2 html table by senik148

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.