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


in reply to Re^2: Dealing with files with differing line endings
in thread Dealing with files with differing line endings

As a practical matter, I am sure that you are right. However, it is important to know that there are corner cases. Consider the following contrived example.
use strict; use warnings; use Test::More tests=>1; my $file = \do{ "This \n is not the end of a line on windows\r\n" }; open my $fh1, '<:raw', $file; my $chars_read = length(<$fh1>); close $fh1; my $chars_expected=47; is( $chars_read, $chars_expected, 'record length' );

OUTPUT:

1..1 not ok 1 - record length # Failed test 'record length' # at nl.pl line 15. # got: '6' # expected: '47' # Looks like you failed 1 test of 1.

Unfortunately, my solution (use :crlf instead of :raw) does not work either.

Bill