http://www.perlmonks.org?node_id=699381


in reply to Format Streaming Text file with CR/LF

The best way depends on what application is going to use the outputted data. On Windows the standard is to use CR-LF at the end of lines, but the convention for Unix systems is just LF.