I just noticed that you never sent the Content-type header. You need to do this before printing anything for the browser to interpret. You can either use CGI to do this, or for such a simple script, just do a print "Content-type: text/html\n\n"; before any other print statements.