you may want to consider using CGI.pm for it's header, start_html and end_html functions. It may not be directly relevant to your problem, but it will help you avoid those 500 server errors if you feed the server a properly formed web page. You are asking it to display "text/html" perhaps you really want "text/plain."