If readability is the goal then how about something like this:
sub foo { return "some output from foo\n"; } print <<' EOPAGE'; some stuff some more stuff EOPAGE print foo(); print <<' EOPAGE'; yet more stuff EOPAGE
Use the "print <<" construct for ONLY the static html and then call your functions directly. If you indent the different prints at different levels, it will be really easy to pick out which ones are which.

An alternate solution to consider is using one of the html template systems. This would be some work to convert your existing code over, but it could be worth it.

I'm going to go out on a limb and bet that you're wanting your code to look something like:

-------------------------------------- #!/usr/bin/perl Here's all my perl code where I set my variables and do my logic print <<EOP; here's all my html where I put in my $vars and @foos EOP ---------------------------------------
so that all your html is in one place and your code in another right? Check out http://www.cpan.org/modules/by-module/HTML/HTML-Template-2.2.readme

/\/\averick


In reply to Re: Embedding fuction output by maverick
in thread Embedding fuction output by RatArsed

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.