Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Answer: printing chr(10) to a file adds chr(13) infront

by BrentDax (Hermit)
on Jul 16, 2001 at 09:13 UTC ( #96962=categorized answer: print w/replies, xml ) Need Help??

Q&A > CGI programming > printing chr(10) to a file adds chr(13) infront - Answer contributed by BrentDax

The trick here is to call binmode() on the filehandle:
open(BINARYFILE, ">file") or die "can't open file for writing: $!"; binmode(BINARYFILE);

Log In?

What's my password?
Create A New User
[Corion]: Well, no computer will start up without the blood sacrifice being made!
[Corion]: I used to cut me on PC cases, but they've gotten better or I don't let blood that easy anymore ;)
[Corion]: You say the girls may strip with your permission, You draw the line dividing art from sin :-D

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-01-16 19:42 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.