On Windows, text files should look like:
line1 CR LF
line2 CR LF
line3 CR LF
Where CR stands for Carriage Return (0D) and LF stands for Line Feed (0A).
The unix format is also acceptable on Windows:
line1 LF
line2 LF
line3 LF
On Macs, you need to use the unix format:
line1 LF
line2 LF
line3 LF
But for some reason, your text file is using the format ancient Macs (pre OS-X) used:
line1 CR
line2 CR
line3 CR
That's wrong. <> reads until the first LF (by default), so it perceives the whole file to be one line. Then, when you print it, the terminal causes each line to be written on top of the previous because CR causes the cursor to be moved to the first column of the line.
print "aaaaa\rbbbb\rccc\n"; # Prints cccba
Fix your corrupted file.
|