It seems you have to add your own HTTP request status, or IIS will generate its own headers and treat yours as text. Try
print "HTTP/1.0 200 OK\nContent-Type: text/html\n\n";
Note I'm just concluding from a bit of googling. I had seen something about header handling being broken on IIS in various CGI scripts, but I haven't ever actually dealt with that problem, so YMMV.