in reply to How is the default "Input Record Separator" set?

The variable $/ deals with records, the layer :crlf deals with lines. We tend to think of lines and records as being the same thing, but they do not have to be. I have never changed $/ for any reason except to make <> read a multi-line block (record) of text rather than a line. I expect the :crlf layer to translate windows line-separators (crlf), within the record, to perl line-separators (\n). Multi-line regexes used to parse the block work as expected.
Bill
  • Comment on Re: How is the default "Input Record Separator" set?

Replies are listed 'Best First'.
Re^2: How is the default "Input Record Separator" set?
by ikegami (Patriarch) on Mar 18, 2021 at 00:34 UTC

    Nonesense. Record is synonymous with line here. It specifically controls what readline considers a line. (<> is short for readline().)

    Seeking work! You can reach me at ikegami@adaelis.com

      You do have a point, but I still think it makes far more sense to refer to the text between record_separators as 'records' and the text between newlines as 'lines' rather than overloading the word 'line' for both. I suspect that this is why the special variable '$/' is called '$INPUT_RECORD_SEPARATOR'. In this view, it is the name of the function 'readline' that is misleading.
      Bill

        Maybe, but it's still $/ and not :crlf that defines a line. :crlf has absolutely nothing to do with that.

        Seeking work! You can reach me at ikegami@adaelis.com