my script works ok, but when running it outputs in plain text

wat i want is to output on same cgi page without calling external html file to be processed by template module

its like i dont want template to process html file from other source. i want it to process the html code which is below

#THIS IS THE TEST.PL use strict; use warnings; use Template; my @names = qw/ Foo Bar Moo /; my $template = Template->new; $template->process('test.pl', { list => \@names }) or die $template->error; print <<START_HTML; <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> <title>Untitled Document</title> </head> <body> [% FOREACH name IN list %] <li> <div class='inforno'> <img src='inforno'> </div> <div class='inforno'> <a href='#' class='inforno'>[% name %]</a> </div> <span class='inforno'> <a href='#' class='inforno'>Edit user</a> </span> </li> [% END %] </body> </html>

OUTPUT IN BROWSER

use strict; use warnings; use Template; my @names = qw/ Foo Bar Moo /; my $template = Template->new; $template->process('test.pl', { list => \@names }) or die $template->error; print <<START_HTML; <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> <title>Untitled Document</title> </head> <body> <li> <div class='inforno'> <img src='inforno'> </div> <div class='inforno'> <a href='#' class='inforno'>Foo</a> </div> <span class='inforno'> <a href='#' class='inforno'>Edit user</a> </span> </li> <li> <div class='inforno'> <img src='inforno'> </div> <div class='inforno'> <a href='#' class='inforno'>Bar</a> </div> <span class='inforno'> <a href='#' class='inforno'>Edit user</a> </span> </li> <li> <div class='inforno'> <img src='inforno'> </div> <div class='inforno'> <a href='#' class='inforno'>Moo</a> </div> <span class='inforno'> <a href='#' class='inforno'>Edit user</a> </span> </li> </body> </html> START_HTML <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> <title>Untitled Document</title> </head> <body> [% FOREACH name IN list %] <li> <div class='inforno'> <img src='inforno'> </div> <div class='inforno'> <a href='#' class='inforno'>[% name %]</a> </div> <span class='inforno'> <a href='#' class='inforno'>Edit user</a> </span> </li> [% END %] </body> </html>

In reply to using template on same page by bigup401

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.