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";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.