Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Tag Archives: carriage-return

[Perl] Beware of carriage-return, even in *nux haven.

Recently I have been using a perl script to analyze returned header from curl and produce a JUnit XML reports.

One small thing that bother me is that it keep generating unnecessary newlines. Of course, I have tried chomp() and couple of similar techniques, but no prevail.

Finally, I though it might be caused by carriage-return (\r) and fixed script accordingly, and it worked as expected.

There is a good document, Why chomp() is not considering carriage-return, provides why chomp() does not process carriage return and how to get around it. But look, there are some carriage-return floating around, especially from web.