one thing, when dealing with debugging 500's, always try running the script from the cmd line and make sure you get the output you were looking for..
CGI::Carp helps as well, but it's a good habit to test your code from the cmd line.. CGI.pm allows you to do this, and asks for query parameters before running the code.. just enter your query string and hit ctrl-D to run the script. It will usually tell you what went wrong.
You can also check the error log files, but that tends to be more cumbersome.. (if you can work with more than one terminal, use a different terminal to
tail -f the error log).
-Syn0