Do you have binmode STDOUT in your script? If your script is being run under Windows, and you want to produce a windows-like file endings, you should not use binmode.
Regards,
Dmitry.
Comment on Re: automatic endlines when saving txt file under windows?