Perl: Carriage Return???

Dave Korn
Sat Apr 28 13:16:00 GMT 2007

On 28 April 2007 11:15, Alexander Konig wrote:

> I cannot imagine what is going wrong with that. Why some parts are just
> overwritten. 

  You have dos-style CRLF line endings instead of posix-style LF line endings.
Run 'd2u' on your input file.

> The same code using Active Perl works. Some weeks ago this script has
> worked using Cygwin, too. 

  Active Perl is win32, so it expects CRLF.  Without knowing more I can't say
why it used to work on cygwin and now doesn't, but among the possibilities are
1) you were using a different input file back then and now you're using a
different one with different line-ends 2) you're using the same file, but in
the past weeks you used notepad or wordpad or some other windows file editor
that changes line endings to CRLF on it, 3) you've upgraded your system
version of bash past the recent change where it stopped accepting CRs by
default 4) you could have been running it on a textmode mountpoint previously
and now you're on a binary one 5) you're using cat with backticks in the shell
construct that you feed the file to the script and cat operating in binary
mode preserves CRLFs.

> Then, I wanted to check a regular expression with this script I had to see
> this weird output. 

  Overwritten messages are almost always a sign of CRLF problems.

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list