If you can provide a sample of your data that would help in giving a precise answer (use Data::Dumper; print Dumper($more_data);). In addition, try some things out yourself and post here if you have questions about the code. I think the general concept would be something like this:

while ( my ($key,$name) = get_key_and_name() ) { my @data; while ( my ($entry) = get_data_for_key($key) ) { push @data, { NUMBER => $entry->{NUMBER}, etc=>"etc" }; } my $data_tmpl = HTML::Template->new(filename => 'data.tmpl'); $data_tmpl->param(NAME => $name, DATA => \@data); write_file("/location/$key.html", $data_tmpl->output); }

(once again untested and based only on the docs - just trying to show the concept of nested while loops here)

Without knowing what $more_data looks like, I can't say what the placeholders get_key_and_name() and get_data_for_key() should look like.


In reply to Re^4: HTML::Template output to files. by Anonymous Monk
in thread HTML::Template output to files. by Anonymous Monk

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.