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

Joe_Cullity has asked for the wisdom of the Perl Monks concerning the following question:

Actually I have 3 questions, 2 technically related, and one on how to be NICE on this message system

First a quick history lesson:
Once a long long time ago (You guys guess my age) a newline “\n” was considered a LineFeed (0x0A). Then Selectric typewriters, and soon after dot matrices printers appeared which also needed a command to send the print ball/head to location zero, so some systems redefined the newline to be a LineFeed followed by a CarriageReturn ( 0x0A + 0x0D ). Someone quickly figured out that it took a lot longer for the ball/print head to move to location zero, then it did to move the paper up one line, so they reversed the chars, issuing the CarriageReturn first and the LineFeed second (0x0D + 0x0A )… and finally someone decide to save space and just send a CarriageReturn char (0x0D) and assume the LineFeed. So now theirs a real mishmash of ideas describing what a newline should be.

The 1st Question:
What does Perl think a newline should be?

Dose Perl decide? Does it depend on the ‘C’ compiler used to create Perl? Maybe it depends on what the operating system thinks a newline should be? Maybe I can define it, so I can pick what a newline should look like.

The 2nd Question:
How does chomp() handle newlines.
Will chomp() remove all forms of newline, or only the exact char or char sequence specified by “\n” ?

The 3rd Question:
A while ago I posted a couple of question and quickly received good accurate answers that I put to use … and forgot about the question. I came back to the board weeks latter and found that people had continued to respond to my question long after I solved the problem. Is there a way to flag the message as already answered/solved? I hate seeing people waist their time solving my already answered questions ?

Thanks Joe_Cullity

Edited 2005-01-05 by Ovid

20050111 Edit by castaway: Changed title from '3 questions... 2 technically related, and one on how to be NICE'