Using a template framework is the right answer. Several good ones have been suggested. You should know, your code as it stands is probably insecure. I am guessing from the snippet that you aren't using strict and that you are doing something like this?

%in = CGI->Vars;

If so—or if the input is coming from users at any stage without being vetted—a malicious URL can be passed to your form and it could do anything from erase or take over your site to hijack other users' accounts. All user input that is displayed as HTML must be HTML encoded: HTML::Entities. Don't save a security "clean-up" pass for last. Have it in mind always: OWASP. Text::Xslate in particular does HTML encoding by default.


In reply to Re: Interpolation of variables in stored HTML by Your Mother
in thread Interpolation of variables in stored HTML by tel2

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.