Okay, just a few suggestions here :)
- Turn on warnings by adding the -w flag and taint mode by adding the -T flag to your path to perl (#!/usr/bin/perl). You should do this with all CGI scripts, they'll help prevent you from doing stupid (and insecure) things.
- You should also always use strict in all your scripts. It will save you tonnes of debugging time and make programming a lot easier for both you and whoever has to maintain your code.
- Do not attempt to hand parse the parameters, it's a lot more difficult than you think and your solution is bound to be buggy and insecure. Use CGI.pm instead.
- Read Essential CGI Security Practices before placing your script online.
- Indent you code so we can read it! :)
You may also wish to consider a templating system such as HTML::Template, It will make your code far more readable and maintainable. After you've done these things feel free to repost so we can whine about relatively minor things like use CGI::Carp 'fatalsToBrowser'; in production code :)