greenhorn has asked for the wisdom of the Perl Monks concerning the following question:
Does anyone know a clean way to test for
DOS v. UNIX EOL in a text file (using Perl) ? It seems
that (chop($UnixLine) == chop($DOSLine))returns true =-(
No one replied. I thought: hey, I might be a mere newbie, but I'll bet I can figure this out.
Wrong. :) I made some small test files with both <CR><LF> line endings and <LF>-only line endings. Then I watched the results of extracting only those characters from each line in the Perl Builder watch-window. It appeared as if the same characters were returned each time (never mind that one line-ending was \x0D\x0Aand the other was \x0Aalone).
It struck me that using ==there wasn't right; should
he not be using "eq"? Had he in fact
actually compared 0 with 0? (0 == 0does have a certain
ring of truth to it.:)
Does perl for Win32 "internally" convert Unix newlines to <CR><LF>?