--- "Johnson, Reginald (GTI)" <[EMAIL PROTECTED]> wrote: > > > > Is coding this way wrong? By "this way" I mean where you don't use > a > > module to write html, but instead do it within the code by using > print > > "Content-type: text/html", "\n\n"; > > > > Example program > > > > #!/usr/bin/perl > > > > print "Content-type: text/html", "\n\n"; > > > > open (OMARFILE, "<junk" || die "input file cannot be > openned:$!\n"); > > > > print <<EOF > > <html> > > <head>
<snip> It's definitely not recommended. There are a number of issues with this, but regarding the HTML, if you produce it, put it in a template such as HTML::Template, Template Toolkit or similar. With that, you can just pass the relevant data to your template and keep your Perl code clean. It makes it easier to debug both the HTML *and* the Perl. If you *must* have self-contained HTML (not recommended), then at least encapsulate it into subroutines which don't obscure the main flow of the program. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Perl and CGI - http://users.easystreet.com/ovid/cgi_course/ Personal blog - http://publius-ovidius.livejournal.com/ Tech blog - http://use.perl.org/~Ovid/journal/