chomp only bites off the last character of the string. Windows is using \r\n for newlines. So, from porting point of view, using s/\r?\n$//g is much more portable.
Another solution would be using chomp in combination with an conditional chop
In reply to Re^2: persistent new line
by Anonymous Monk
in thread persistent new line
by enkibian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |