in reply to Re^3: How to match last character of string, even if it happens to be a newline?
in thread How to match last character of string, even if it happens to be a newline?
In Perl, "\n" is always one character, regardless of the platform. It is written as two bytes if you use the default encoding on some platforms, Windows being the most popular. Newline has a nice overview.
If you read a file containing 0D0A using the default encoding on Unix platforms, or with binmode on any platform, you get two characters "\r\n" which you can (or have to) process.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to match last character of string, even if it happens to be a newline?
by LanX (Saint) on May 13, 2019 at 16:49 UTC | |
by haukex (Archbishop) on May 13, 2019 at 18:18 UTC | |
by LanX (Saint) on May 13, 2019 at 20:34 UTC | |
by afoken (Chancellor) on May 14, 2019 at 18:01 UTC | |
by LanX (Saint) on May 14, 2019 at 18:07 UTC |