EVERY cgi must do: print "Content-type: text/html\n" before ANY printing occurs. Note there should be TWO \n's, print does one of them for you.