Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How is the default "Input Record Separator" set?

by BillKSmith (Monsignor)
on Mar 15, 2021 at 19:27 UTC ( #11129717=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-05-28 01:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (98 votes). Check out past polls.

    Notices?