in reply to Re^4: different length of a line from linux and windows textfile? ("\r")
in thread different length of a line from linux and windows textfile?

No, you are both wrong. chomp just removes a trailing "\n" (by default). On every platform (I'm ignoring how ancient MacOS misdefined "\r", of course).

Running Perl on Windows will likely cause a "\r\n" in a file to end up as just "\n" in your Perl string. In that case, the fact that chomp does nothing to "\r" doesn't cause a problem. But it is not chomp that is getting rid of the "\r" for you.

You can actually make chomp get rid of "\r\n" by setting $/ = "\r\n", but that also makes chomp not get rid of "\n" (unless it is immediately preceded by "\r"). So that's a worse idea.

s/\s+$// is a much better idea than chomp.

- tye