http://qs321.pair.com?node_id=819852


in reply to Re: Perl Files Corrumpted
in thread Perl Files Corrumpted

Indeed, dropping the "\r" from the traditional Win32 line ending of "\r\n" means that Notepad.exe (and others of the more stupid Win32 programs) don't recognize the bare "\n" as a real line ending. So you get all of the code run together in one big line that looks quite like an unintelligible mess.

My first suggestion would be to get a better editor. But restoring the line endings to "\r\n" is pretty easy. If you have (a native) Perl on Win32, then you can do that as simply as:

perl -pi-i -e "BEGIN{@ARGV=map{glob}@ARGV}" *.pl REM check the new *.pl file contents REM if everything looks good, then: del *.pl-i

Guru meditation

- tye        

Replies are listed 'Best First'.
Re^3: Perl Files Corrumpted (\r)
by quester (Vicar) on Jan 27, 2010 at 11:01 UTC
    You can also do that with nothing more than Wordpad from Windows Progams->Accessories. It will display the file properly. If you hit the save button, it will save the file with the correct \r\n line endings.