For printing multiple lines of static content (static that you don't have to check a condition if you want to print that), you can use HERE-documents.
Or you give a list of strings as arguments to that print (within this you can even check the conditions, if you must to):

# it interpolates variables print OUT <<"END_OF_PRINT"; Hello $world. many lines many lines END_OF_PRINT
print OUT "string1\n", "string2\n", "string3\n", ;

But all these solutions lead to CountZero's answer. Have you already considered his tip about using a templating system?

You create a template with all the static content you have.
In place of the non-static content you set up placeholders.
Inside your Perl-Code you load your template with the corresponding
template system and define the content for the placeholders.
Then you print the generated output.
The details are related to the template system you choose.

Additional point (not related to the templates):

If you open a file for writing, you should check that the open was successful:

open OUT, '>', $file or die "$file: open for writing failed: $!\n";

You should also check the success of all prints and the final close on that handle OUT.

print OUT "text bla bla\n" or die "$file: print failed: $!\n"; close OUT or die "$file: close failed: $!\n";

If you manage to reduce the number of prints these checks aren't too bad ;o)


In reply to Re^3: LaTeX Wizard by linuxer
in thread LaTeX Wizard by milarepa

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.