in reply to Creating Unix Friendly files in win32
will print out on a unix machine, for a 10-line file test.txt created on Win32,use strict; use warnings; open(my $fh, '<', 'test.txt') or die $!; my $count = 0; while (<$fh>) { $count++ if /\r/; } close $fh; print "Without :crlf, \$count=$count\n"; open($fh, '<:crlf', 'test.txt') or die $!; $count = 0; while (<$fh>) { $count++ if /\r/; } close $fh; print "With :crlf, \$count=$count\n";
Without :crlf, $count=10 With :crlf, $count=0
|
|---|