in reply to HTML In CGI Scripts.

I asked a very similar question a long time ago. Following the advice of the respondents, I quickly learned HTML::Template and have never looked back. Basically, the most important advice is learn a templating system. You will need it sooner or later.

Putting the HTML outputting code in a subroutine is the first step. If you've gotten this far, you probably realize that HTML interspersed with code can get pretty nasty. But eventually, you will need functionality more complex than just variable substitution into your HTML skeleton. At this point, instead of reinventing this very common wheel, learning a templating system will save you a lot of grief. There are several good ones out there.

And if you ever get serious about CGI scripts (as in, coding for money), you will eventually be working with designers. Take it from me, you do NOT want them opening your Perl code to tweak some HTML!

blokhead