I know that I am a week late and slightly off topic. You probably want to read your file line-by-line rather than slurping the whole thing. Use
$INPUT_RECORD_SEPARAROR.
use strict;
use warnings;
use autodie;
use English;
my $mac_file =
'#EXTM3U' . "\N{CARRIAGE RETURN}" .
'#EXTINF:547,Excerpt from the Binti' . "\N{CARRIAGE RETURN}" .
'Excerpt from the Binti novella series by Nnedi Okorafor.mp3'.
"\N{CARRIAGE RETURN}"
;
open my $MAC_FH, '<', \$mac_file;
my @lines;
while (my $line = do{local $INPUT_RECORD_SEPARATOR = "\r";<$MAC_FH>})
+{
#$line =~ tr/\r/\n/;
push @lines, $line;
}
close $MAC_FH;
print "Line0: ", $lines[0], "\n";
print "Line1: ", $lines[1], "\n";
print "Line2: ", $lines[2], "\n";