I recently have had to move some scripts to a new server and have run into a problem. Scripts that worked perfectly on the old server are returning a 500 error (Malformed Header).

A (Hello world!) test script which fails with the above error is:
#!/usr/bin/perl use CGI qw(:standard); use strict; sub printpage(); printpage(); exit; sub printpage(){ print << "EOF"; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/T +R/html4/loose.dtd"> <html> <head> <title>Thanks for your request </title> </head> <body> <p>Thanks for submitting your information. We will get back to you sho +rtly</p><br> </body> </html> EOF }
This works as expected running locally but generates the error on the server.

Server config:
Operating system ... Linux
Kernel version ... 2.4.26
Apache version ... 1.3.31 (Unix)
PERL version ... 5.8.1
Path to PERL ... /usr/bin/perl


Has anybody experienced this before?
I think it must be something to do with the Apache/suExec config - but as I am still a Perl novice would like to have a sanity check (while I await a response from my hosting co).

In reply to Malformed Header Error by macPerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.