Your "internal server error" means your code had an error that probably ended up in your webserver's error log. Having access to the error log is really mandatory for doing web development, but in a pinch you can put a
use CGI::Carp qw(fatalsToBrowser); at the very top of your script and see some errors in the browser.