In text mode, however, the standard I/O library automatically translates LF into CRLF pairs on the way out, and CRLF pairs into LF on the way in. The virtue of this is that it makes text operations on Windows and UNIX Perls look the same—from the programmer's point of view, the DOS text files end in a single \n character, just as they do in UNIX. The problem one runs into is when reading and writing binary files—such as images or indexed databases—and the files become mysteriously corrupted on input or output. This is due to the default line-end translation. Should this happen to you, you should turn off character translation by calling binmode() on the filehandle.Generally one ought not to run binmode() when one is reading and writing text on Windows and VMS system. But reading between the lines of Stein's advice makes me think that perhaps one ought to turn on binmode only as needed even when running binary files.
When I used to open up DOS binary files in text editors I would often see what looked like meaningful text there. Perhaps "to every thing there is a season" as it says in Ecclesiastes and even binary files should sometimes be run without binmode() in order to handle these meaningful snippets of text in binary files.
In reply to Re: Re: CGI File upload, resulting files 0 bytes long
by sierrathedog04
in thread CGI File upload, resulting files 0 bytes long
by Mandor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |