Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Changing CRLF in Windows to LF for UNIX

by pwagyi (Monk)
on Nov 02, 2018 at 08:36 UTC ( [id://1225087] : note . print w/replies, xml ) Need Help??


in reply to Re^2: Changing CRLF in Windows to LF for UNIX
in thread Changing CRLF in Windows to LF for UNIX

You should use 3 arg open FILEHANDLE,MODE,EXPR. I tried out the code and it does work for me.

>> I'm coding in Windows (Windows 10) and trying to change a Windows created text file that ends in CRLF to just LF, so that I can upload the file and process it on a Unix-based site.

If you are running the script in Windows, it will happen since when you open for write (without binmode or :raw or :unix), Perl will perform '\n' to (Windows) platform '\r\n'.