Your description of the problem is too confusing (confused). What/where is this "html file" that has these comment tags like "<!-- 2 -- > and so forth"? Why are you using a format that is not really XML or HTML (or XHTML)? What does a client/user supply? What does the client/user want in response?

Get down to first principles. Break things up into individual, modular components that do specific, simple parts of the task. Plug these components into subroutine calls in loops as needed, and make the code look like a natural-language description of the task. (I gather that English is not your first language, whereas it tends to be the first natural language for perl; this might be a problem, but sticking to simple "command-style" statements ("do this, then do that, then...") will serve you well enough.

Separate the creation/management of data structure from the presentation of data, and set up a main-level controller that uses those two sets of functions ("model vs. view vs. control"). Based on what you've shown so far, I don't think there's anything else I can offer.


In reply to Re^3: Combining calls to a subroutine issue. by graff
in thread Combining calls to a subroutine issue. 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.