in reply to How to get over 'premature end of script headers' in Apache?

Be sure to send correct HTTP headers:

print "Content-type: text/html\n\n";
or
use CGI; print header();