in reply to My CGI gives "document contained no data"

The super annoying thing about the headers is that the official HTTP spec says you should use CR-LF. Yes, that makes you ask what OS those guys were smoking at the time. Maybe your Web server will be kind enough to fix this for you, so you might not even notice there's a problem, but just because the rules are silly doesn't mean you should break them.

As such, you should never print your own headers, and should get CGI.pm to do all the dirty work for you:
print $q->header();