my $cgi = new CGI(); # Declare this near the top of the script. print $cgi->header(); # In place of your "Print: content-type..." statement.