http://www.perlmonks.org?node_id=771672


in reply to Re^8: Weird error log message
in thread Weird error log message

The problem was that your edited is adding a BOM before the shebang line, so your web server didn't accurately detect the shebang line. "#!" must appear at the very top of the file and it wasn't. The following will remove the UTF-8 BOM from a file:

perl -i.bak -ple"s/^\xEF\xBB\xBF// if $.==1" script.cgi

Note that if your source is UTF-8, you should probably use use utf8;.