Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Reading lines beginning with pound # ignored

by BillKSmith (Monsignor)
on Jun 23, 2023 at 15:52 UTC ( [id://11153099]=note: print w/replies, xml ) Need Help??


in reply to Reading lines beginning with pound # ignored

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";
Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11153099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2026-04-21 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.