in reply to Using a template

If you like the way PHP lets your work, you might be interested in similar things in Perl, like Embperl, Apache::ASP, and Mason.

There are lots of good templating tools for use in CGI scripts too. Take a look at my article on this subject.