Be sure that you're returning a valid header to the browser before any content. The standard header for HTML is: Content-type: text/html, followed by two newlines. If you're using CGI.pm, you can use the following:
may be of use to you. (I read it five or six times while making my first Perl CGI, and two times for the second. Don't mind the title.)