in reply to text files from mac

Your script looks like it would work fine if it were fed pure Mac OS 9 or earlier text. Probably what's happening is you are dealing with text from Mac OS X, which has unix-style newlines, with \015 (\f) as the newline (not \r, which is \012, and was the traditional Mac newline before OS X). This will result in a square when reading on a Windows machine because it does not recognize \015 as a newline at all.

The actual newlines in your output come not from the original file but from your printing "\n" in the while loop, since \n is the "logical newline" for your system, in your case Windows, and thus generates the correct \012\015 sequence.

PS If I am correct about your using Mac OS X files then simply changing $/ to "\015" (untested and not sure if I have the syntax right) should solve your problem.

Replies are listed 'Best First'.
Re^2: text files from mac
by Anonymous Monk on Apr 20, 2005 at 12:55 UTC
    ta! the first too snippets give the same output as my code prompting me to think that there is some other problem like corrupted disk/data the machine isn't OS X though was the first thing i checked coz its the only kind of mac i know anything about (and then the only thing i no is that its basically UNIX) i was hoping to ftp the beasts to my LINUX machine and then no problem but alas this wasn't the case