Aaah! Evil! Where's your use strict?! If you had one there you'd see that @field_data is being created in one while loop and then passed to a function from a different context. Bad! Doing things like that makes it hard for us to read, which may explain your lack of responses.

I like they way I can recognise the comments from the HTML::Template examples ;) I spent a lot of time copying out that example and modifying it too.

Without claiming I know much better, I would probably shorten this bit a little:

my @newfields = (); foreach $field (@fields){ push(@newfields, $field); } while (@newfields) { get_values(); my %nf_row_data; $nf_row_data{FIELD} = shift @newfields; push(@field_data, \%nf_row_data); }

can be written as (untested):

my @newfields = (); foreach $field (@fields){ get_values(); my %nf_row_data; $nf_row_data{FIELD} = $_; push(@field_data, \%nf_row_data); }

But why do you have get_values() there at all? You don't need it, because you have already used @keys and @values, right?

Also it is bad practise to have get_values() modify a global variable. Pass @keys and @values out of the subroutine like this:  return \@keys, \@values

Put use strict; at the top of your program, fix all the errors, then post again.

____________________
Jeremy
I didn't believe in evil until I dated it.


In reply to Re: How can I display DBM entries in an HTML table? by jepri
in thread How can I display DBM entries in an HTML table? by bladx

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.