I see that you have resolved your problem while I was composing this response but I might as well post it anyway in case it is helpful.
As you found, chomping MS Windows line terminators on a *nix type system without taking extra measures causes problems. Using split, ord, sprintf and map can be helpful in visualising what is happening to your data, it is much clearer than just printing each line. Your solution is to modify the default line terminator, which is the second item in the following code. Note the difference pre-chomp between that method and the :crlf I/O layer in my third item which actually removes the carriage return during the readline leaving just the line feed.
use strict;
use warnings;
use feature qw{ say };
my $winLineTerm = qq{\x0d\x0a};
my( $file, $writeFH, $readFH );
say q{-} x 20;
open $writeFH, q{>}, \ $file or die $!;
print $writeFH qq{ABC${winLineTerm}DEF$winLineTerm};
close $writeFH or die $!;
say q{No measures};
open $readFH, q{<}, \ $file or die $!;
while ( <$readFH> )
{
say q{Before chomp()};
say for map { sprintf q{ %#02x}, ord } split m{};
say q{After chomp()};
chomp;
say for map { sprintf q{ %#02x}, ord } split m{};
}
close $readFH or die $!;
say q{-} x 20;
say q{Change default line terminator};
{
local $/ = $winLineTerm;
open $readFH, q{<}, \ $file or die $!;
while ( <$readFH> )
{
say q{Before chomp()};
say for map { sprintf q{ %#02x}, ord } split m{};
say q{After chomp()};
chomp;
say for map { sprintf q{ %#02x}, ord } split m{};
}
close $readFH or die $!;
}
say q{-} x 20;
say q{open() with :crlf I/O layer};
open $readFH, q{<:crlf}, \ $file or die $!;
while ( <$readFH> )
{
say q{Before chomp()};
say for map { sprintf q{ %#02x}, ord } split m{};
say q{After chomp()};
chomp;
say for map { sprintf q{ %#02x}, ord } split m{};
}
close $readFH or die $!;
say q{-} x 20;
The output.
--------------------
No measures
Before chomp()
0x41
0x42
0x43
0xd
0xa
After chomp()
0x41
0x42
0x43
0xd
Before chomp()
0x44
0x45
0x46
0xd
0xa
After chomp()
0x44
0x45
0x46
0xd
--------------------
Change default line terminator
Before chomp()
0x41
0x42
0x43
0xd
0xa
After chomp()
0x41
0x42
0x43
Before chomp()
0x44
0x45
0x46
0xd
0xa
After chomp()
0x44
0x45
0x46
--------------------
open() with :crlf I/O layer
Before chomp()
0x41
0x42
0x43
0xa
After chomp()
0x41
0x42
0x43
Before chomp()
0x44
0x45
0x46
0xa
After chomp()
0x44
0x45
0x46
--------------------
I hope this is of interest.