T
Tim Greer
"Hey Wally, whats in that 'if()' statement?".
-sln
You remind me of Xah Lee. You aren't really him, are you?
"Hey Wally, whats in that 'if()' statement?".
-sln
Ben said:It's a little unclear, and of course the reference to STDIO is
incorrect. What it means is
In DOSish perls, "\n" means "\012", but when accessing a file by
default a :crlf layer is pushed which will result in "\015\012"
appearing in the file.
Tim McDaniel said:As a practical matter, I run enough scripts on Windows (whether
under bash or cmd) and have hit the problem enough that I do
chomp;
s/\r+$//;
as a matter of rote, or instead use \s if I want to strip all trailing
whitespace whatsoever.
Why not just
s/[\r\n]+$//;
in one operation and skip the chomp?
Tim said:Why not justTim McDaniel said:As a practical matter, I run enough scripts on Windows (whether
under bash or cmd) and have hit the problem enough that I do
chomp;
s/\r+$//;
as a matter of rote, or instead use \s if I want to strip all trailing
whitespace whatsoever.
s/[\r\n]+$//;
in one operation and skip the chomp?
That would assume that $/ contains only carriage returns and ASCII
newlines (that is, not considering the "\n" special casing that gets
done when doing I/O on non-binary files).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.