Definite's Extractor

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

[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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: