in reply to Re^5: Detect line endings with CGI.pm upload
in thread Detect line endings with CGI.pm upload

Not true.

>perl -le"print length qq{\n}" 1 >perl -le"print unpack 'H*', qq{\n}" 0a

It's not true in C either.

#include <string.h> #include <stdio.h> int main() { printf("%d\n", strlen("\n")); { const char* p = "\n"; while (*p) { printf("%02x", *(p++)); } printf("\n"); } return 0; }
1 0a

In Perl, LF gets converted to CRLF on input/output when the crlf PerlIO layer is used. While the string is in memory, you want to work with just LF, and \n is just LF.