Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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'.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1225087]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found