$ hexdump -C foo.txt
00000000 46 6f 6f 0d 42 61 72 0d 51 75 7a 0d |Foo.Bar.Quz.|
0000000c
$ cat read.pl
#!/usr/bin/env perl
use warnings;
use strict;
use Data::Dumper;
$Data::Dumper::Useqq=1;
open my $fh, '<', 'foo.txt' or die $!;
print Dumper([PerlIO::get_layers($fh)]) unless $] lt '5.008';
while (<$fh>) {
print Dumper($_);
}
close $fh;
####
$VAR1 = [
"unix",
"crlf"
];
$VAR1 = "Foo\rBar\rQuz\r";
####
# 5.6.2:
$VAR1 = "Foo\rBar\rQuz\r";
# 5.8.1 and 5.8.9:
$VAR1 = [
"stdio"
];
$VAR1 = "Foo\rBar\rQuz\r";
# 5.10.1 thru 5.26:
$VAR1 = [
"unix",
"perlio"
];
$VAR1 = "Foo\rBar\rQuz\r";
####
use warnings;
use strict;
open my $fh, '<', 'foo.txt' or die $!;
binmode $fh;
$/="\x0D";
while (<$fh>) {
chomp;
...
}
close $fh;