You should learn the HTML shortcuts that are provided with the CGI module. The following subroutine from this web page generates a Web page using Perl, with no HTML in the Perl, which is what I assume is what you are asking for.
sub create_web_page { my %in_data = ( @_ ); my $file = "C:/windows/desktop/cgi_course/appendices/appendi +x2.html"; # Always check return codes! open OUT, ">$file" or die "Cannot open $file for writing: $!\n"; print OUT $q->start_html( -title => "URL and HTML Character Codes" +, -style => { src => '../style.css', type => 'text/css' }, -author=> 'poec@yahoo.com' ), $q->h1( 'URL and HTML Character Codes' ). $q->p( 'This Web page was created with Perl, using CGI.pm and s +everal other modules.', 'See the source code at the end of the page for how I cr +eated it.' ), $q->p( 'Some may object to my listing HTML character codes for +"unused" characters', 'such as ASCII 127 (hex 7F), but browser support for the +se characters is spotty.', 'Different browsers will choose to render these characte +rs or not (e.g. IE 5.01', 'recognizes € as the Euro "€" symbol, but Netsc +ape 4.7 does not). Owing', 'to this difficulty, I have elected to leave things as t +hey are and let you pick', 'and choose the characters you need as you like.' ), $q->em( 'Amongst other things, the program reads its source code + to create this page.' ), $q->p( ' ' ), $q->table( $q->Tr ( $q->th( $in_data{ headers} ) ), $in_data{ data } ), $q->p( 'Back to the ' . $q->a( { -href => '../index.html' }, 'ta +ble of contents' ) . '.' ), $q->pre( { class => 'program' }, $in_data{ code } ), $q->end_html; close OUT; }
However, this is usually a bad idea if you want to create large, scalable sites. http://www.template-toolkit.org has a great discussion of why templates are typically the way to go. If the Template Toolkit is too daunting, try Using HTML::Template. It's a simpler solution and very easy to implement.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re: Websites by Ovid
in thread Websites by kakarot

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.