in reply to How to use Perl in web pages?

Hey man,

I'd say I'm in the same boat as you. I've done some web development in PHP, and decided to at least try Perl out. Soon enough, I liked it a whole lot better.

As previously mentioned, your first step is to learn the basics of Perl. A lot of it is similar to PHP, but there's also a lot that just makes more sense. Head over to this free library to read up. It will stall whatever web projects you have going, but I think without taking time to learn, your code will essentially be PHP code written in Perl.

Regardless, the biggest difference between PHP and Perl is that PHP was made for the web. And so, PHP will automatically handle a lot of things for you, which you need to manually do in Perl. For example, consider headers. At the end of the script, PHP will automatically send your header, unless you specified that a different header be sent. Also, any cookies set via setcookie will be sent with that header. In Perl, you have to do that yourself: It's not hard, but it tripped me up, especially before I realized that any and all cookies needed to be sent with the header.

If you haven't already started to try to use a templating system, I'd strongly suggest that. It may not make much sense at first... but try using it for a bit, and then compare your results to what you had before. You will get much cleaner results, and even if you aren't hiring some HTML kiddie who doens't know Perl, this will help you out. It's much much easier to trouble shoot your HTML / CSS without your Perl getting in the way, and vice versa.

So, as a direct answer to your question: It's possible, both using CGI and print'ing your HTML, and with something like HTML::Mason. However, try out the Template Toolkit. Using this tutorial, I literally learned the basics and made a simple dynamic page in about ninety seconds. Still, to each his own: Do what you're comfortable with, and if it's not for you, know that there are other options out there. Kind of like moving to Perl from PHP ;-).

Best of luck!
Salazar