Your code leaves a little to be desired...
- The formatting is... well... almost non-existent.
- You aren't using -w or use strict;.
- You aren't taint checking.
- You use the CGI module seemingly for one thing: printing out the header. (Why use CGI if you are going to parse the query string by hand?)
- Your program starts with over 50 separate print statements. (Time to learn about here docs.)
- Most of those 50 prints are writing out javascript...
- Your error messages (e.g. open ... ||die("You suck");) aren't very informative.
- Half the time you don't check the return from open at all.
- WARNING! You have introduced a security hole and opened yourself to remote exploits by using tainted user supplied data inside backticks! This is no joke. If that code is up, anyone with access to it via the web can run arbitrary code on your server with the same privileges as the web server itself.
My advice: don't walk... run and take that "code" off your server, delete it, read perldoc perlsec very very carefully, read perldoc CGI carefully, get yourself a copy of perltidy and learn how to use it, get a book on Perl and maybe one on CGI, educate yourself a bit, and then start with a less ambitious project.
I know that's a little rough. I don't mean to be insulting; I just mean to tell it like it is. If you don't listen to the rest of my advice, at least listen to the part about taking that code off your server.
-sauoq
"My two cents aren't worth a dime.";