in reply to CGI example

From the looks of your code, I'm really not too sure what you are trying to do, and if CGI is really necessary.

IMHO, the first question you should ask yourself is "why do I need to use CGI?" I.e., what are you trying to accomplish by using it? As a web developer myself, I use it for 1) on a simple level: processing forms, and 2) on a more complex level: building out database-driven, content-managed sites.

When I first started programming in Perl/CGI, I wanted to process forms, e.g., a contact form. This meant validating the input, sticking the input into a database, sending a notification email, and finally returning a thank-you page (one of the most recommended of many of the Tutorials is the venerable Ovid's CGI Course).

As I progressed, I naturally moved into templating (HTML::Template is one of the post-popular and easy to use) and finally frameworks (meraxes mentioned CGI::Application, which is my tool of choice for the heavier lifting).

Depending on your goal, you may not need CGI at all (unless for a purely academic exercise). Make sure the tool matches the task and that you're not using a 20oz sledge for finishing nail.

Again, check out the Monasteries great Tutorials.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot