in reply to Re: Strange behavior with STDIN
in thread Strange behavior with STDIN
chomp only removes $/, which is a LF (by default). Even on Windows.
That's not a problem because the CR are usually removed by the time you use chomp.
On a Windows build,
text input handles replace CR+LF with just LF.
text output handles replace LF with CR+LF.
Either the OP is reading Windows text on a unix build of perl, or STDIN has been binmoded.
I suppose another possibility is that the input is garbage of the form "name␍␍␊" which is transformed into "name␍␊" on read and chomped to "name␍".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Strange behavior with STDIN
by LanX (Saint) on Oct 26, 2021 at 19:57 UTC |