in reply to Reading text file with <CR> line endings

What is chomp producing?

update

see also $/ and perlport#Newlines

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

  • Comment on Re: Reading text file with <CR> line endings

Replies are listed 'Best First'.
Re^2: Reading text file with <CR> line endings
by Marshall (Canon) on Mar 02, 2018 at 18:44 UTC
    I've got a bit of an issue because in my fiddling with this thing, I over-wrote the file. I can get it back and try chomp(), but my regex should be even better? Here is more of the actual code... #lines were used in my testing...
    while (my $line = <IN>) { # print "line=$line\n"; next if $line =~/^\s*\w+:/; # The Run_Time: line next if $line =~/^\s*$/; # A blank line $line =~ s/\s*$//; # No trailing spaces or line ending $line =~ s/^\s*//; # No leading space next if $line =~ /^Call/; # Skip the CSV header line my($call,$bracket) = (split /\|/,$line)[0,-1]; # print "$call, $bracket\n"; #### nothing printed here either # more processing ... not shown.. }