in reply to Re^2: parsing csv with Text::ParseWords
in thread parsing csv with Text::ParseWords

The EOL in Perl source is just "\n". On Unix that literally is all that there is. On Windows, there is a \r\n sequence. I would assume that you don't need to specify EOL for your CSV module, just let Perl do its default thing, eg leave EOL => 'x' off! And let default do its work.

I have moved files between Unix and Windows and Perl can read files created in either place. When I save a file under Unix, EOL is just \n. When saved under Windows it is \r\n. The Windows Perl can read the Unix Perl's file and vice-versa. My normal text editor, TextPad can do the same thing.

If you process a Windows file that came from a Unix system, when Perl writes it, it will put in the \r\n sequence for Perl "\n". When the Unix Perl writes a file that came from Windows, it just puts in \n instead of \r\n.

So in Perl: print "qwerty\n"; the \n may be 2 characters depending upon which OS you are running Perl under.

If you could explain this problem more with an example, that would be helpful. This is a well-known common problem.

I don't know the full history of why Windows did it this way. But in ancient mechanical paper tape days, each line ended with "carriage return(\r), line feed(\n), rubout(del). The teletype machine was dumb and need the \r to return print head to the next line and \n to advance the paper. The rubout (all 8 positions punched) was to keep mechanical fingers lubricated via the oil on the tape. The ASR 33 teletype was a "dodo bird" by even the time of DOS. Anyway this EOL problem is well known and there are solutions.