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

In reply to Re: CGI example by bradcathey
in thread CGI example by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.