in reply to \r\n at end of line

s/\r?\n\z//

(Does Perl remove a plain "\n" in Windows? If so, I'm surprised, since $/ isn't a regexp.)

Replies are listed 'Best First'.
Re^2: \r\n at end of line
by ikegami (Patriarch) on Apr 19, 2011 at 03:55 UTC
    A :crlf layer is used by default on Windows, converting CRLF to LF on read and vice-versa on write. Therefore, $/ is "\n" on Windows too.