On Wed, 11 May 2005, Malcolm Dew-Jones wrote:
Each line break is supposed to be the two character sequence "\r\n" (i.e.
Carriage-return Line-feed, normally "\r\n" will do that in perl,
What \r and \n represent in Perl is patform-dependent. If you mean
precisely carriage return and linefeed, then you better code what you
mean, i.e \012 and \015.
There's a Perl FAQ about this issue.
though on some hardware you might need something else).
If you do it right then that problem disappears. (Well, there's also
the problem of EBCDIC-based platforms...)
Perhaps that makes a difference.
That depends on whether the script is constructing a CGI response, or
an HTTP response.
CGI responses are governed by the CGI specification (now an
informational RFC) and addressed by Perlfaq9. They accept the
platform's own newline representation (it's the server's job to
construct a protocol-conforming HTTP response based on them).
HTTP responses are governed by RFC2616 and do indeed call for CRLF
as the newline representation, irrespective of platform.
Ref:
http://perlpod.com/5.9.1/pod/perlfaq9.html
"What is the correct form of response from a CGI script?"
(I have to declare an interest, but that was written after an
intensive peer review ;-)
all the best