in reply to Re^2: Getting data ready for HTML::Template
in thread Getting data ready for HTML::Template

The remaining problem is that you push \%row_data into your array, which is the same pointer to the same data structure (which gets written to three times until only the last row data remains) instead of a new one. The easiest way to generate a new hash every time through the loop is to change the third line of Unforgivens loop
%row_data = ();
to
my %row_data = ();

Replies are listed 'Best First'.
Re^4: Getting data ready for HTML::Template
by gctaylor1 (Hermit) on Nov 19, 2009 at 02:33 UTC
    Awesome! Thanks for these solutions. It's now working to the point where I can figure out the rest because it's just formatting.

    Machine Key One Key Two Key Three
    machine1 value1 value2 value3
    machine2 value4 value5 value6
    machine3 value7 value8 value9

    Here's the final segment of code:

    Thank you for the help!
      Could you also provide the code for the template?

      What exactly is your problem? Do you want the table headings aligned with the data? If yes, why the heck do you put headings and data into two completely independent tables? Use a single table. As a side note, get rid of the border attribute and use CSS instead.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^4: Getting data ready for HTML::Template
by Unforgiven (Hermit) on Nov 19, 2009 at 14:37 UTC

    Gah, I knew I was forgetting to mention something else. Thanks for catching that.

    It's an example of keeping your variables close to where they're used. For most cases, it's better to declare a variable, use it, then stop using it. If nothing else, when reading your code, it makes it easier to keep all those variables you're actively using in your head, since as soon as you're done with it, you can forget about it.