in reply to Incorrectly adding a newline character

Hi,

if you're on UNIX and have a text file which lines ends with \r\n the chomp only throws the \n away, but not \r. Have a look at your file with hexdump -C.

Regards
McA