Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Trim blanks from the beginning and end of a multi-line string

by Marshall (Canon)
on Jan 29, 2012 at 16:28 UTC ( [id://950594]=note: print w/replies, xml ) Need Help??


in reply to Re: Trim blanks from the beginning and end of a multi-line string
in thread Trim blanks from the beginning and end of a multi-line string

Normally that is not needed because this \n is "magical" - it handles <LF> Unix style "new line" and Windows style <CR><LF> "new line". If you write a "\n", it will write that platform specific type of "new line". When you read that file on the other platform, the other platform's "newline" is ok.

Update: For the folks who may not be up on the terminology... CR, Carriage Return is what \r is. LF, Line Feed is the character that Unix will write for "\n". Windows will write both for a "new line". As trivia, the convention for network transmission of lines of text (like over a socket) is the same as Windows, <CR><LF> that's true even on Unix system. Perl handles all this oddness in a very nice and magical way - basically the "right thing" happens (Do What I Meant).

  • Comment on Re^2: Trim blanks from the beginning and end of a multi-line string

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-24 02:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found