http://www.perlmonks.org?node_id=1038730


in reply to Re: Perl ignores CarriageReturn during fileparsing. Why?
in thread Perl ignores CarriageReturn during fileparsing. Why?

You are my god for today - Wrong value within $/ (INPUT_RECORD_SEPARATOR) was the culprit; resetting it to '\n' solves my problem.
I assumed there has to be a special variable for this - but couldn't find it ...
Any change I made must have altered the value of $/ - have to find out which.

Replies are listed 'Best First'.
Re^3: Perl ignores CarriageReturn during fileparsing. Why?
by space_monk (Chaplain) on Jun 13, 2013 at 12:29 UTC
    Normally the input record separator should only be changed in the scope for which you need to change it
    # code "borrowed" from node 1952 :-) { local $/ = undef; open FILE, "myfile" or die "Couldn't open file: $!"; $string = <FILE>; close FILE; } # $/ reverts back to default here...
    If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)
      The change happened by accident and not intentional - until now I wasn't able to locate the change within my own code. Perhaps it happens somewhere in an external perl module ....