Since you're learning about CGI, I did a post about a tool
that allows you to keep the Perl code and the HTML files separate.
The more I use it, the better I like it.
My cgi scripts are smaller and faster as a result of this technique.
I have expanded my use of the hash (%TWORK) so that now I keep all input fields and
all calculated results in the same hash. I use 'read' to slurp the file in all at once, and then I call the subroutine once, and then print the output to the web server. You can have someone else(web/graphic designer) edit the HTML file, and your code stays intact.
"Well done is better than well said." - Benjamin Franklin