in reply to Re: How is the default "Input Record Separator" set?
in thread How is the default "Input Record Separator" set?
We've been over this at length: Test before posting.
Unless you are using binmode, you will never see a <CR>. I am not even sure that you can even set $/ to CRLF. Please show some code where you think that you did that.
use warnings; use strict; use Data::Dumper; $Data::Dumper::Useqq=1; open my $fh, '>:raw', 'test.txt' or die $!; print $fh "x\ry\r\n"; close $fh; open $fh, '<', 'test.txt' or die $!; my $in = <$fh>; close $fh; print Dumper($in); # "x\ry\n" open $fh, '<:raw', 'test.txt' or die $!; local $/ = "\r\n"; chomp( $in = <$fh> ); close $fh; print Dumper($in); # "x\ry"
Which also means that you meant with "The text I/O layers will take out <CR> and what Perl sees is just <LF>." is wrong, the :crlf layer doesn't just strip all CRs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How is the default "Input Record Separator" set?
by Marshall (Canon) on Mar 17, 2021 at 18:54 UTC |