title: Internal Server Error 500 thrown from perl script -but script works fine
body: <p>I have a perl script which is called via Ajax. It simply writes 3 values to a database. The code works fine (values get written successfully) but I get an "Internal Server Error" thrown. The Errorlog says "premature end of script headers".</p>
  
  <p>There was no problem with the application - it works as required and has for a few months - but I noticed the error via Firebug when testing something else. </p>
  
  <p>So I started stripping perl out of the script in an attempt to locate the problem .. and continued till I only had only had two lines left .. the shebang and exit .. I still get the 500 error. Running the script direct from a browser gives the 500 error in the browser window ... from the command prompt it's fine - ie. nothing in the apache errorlog. </p>
  
  <p>There is nothing wrong with the server configuration - it has hundreds of perl scripts and has been running for years.</p>