C:\Users\Laurent>perl -e "print qq{foo\nbar}" > foobar.txt
C:\Users\Laurent>type foobar.txt
foo
bar
Looking at the hexadecimal content of foobar.txt:
66 6F 6F 0D 0A 62 61 72 ; foo..bar
Although I used only "\n" in the script, Perl was clever enough to transform it into a windowish "\r\n" (0D 0A) end of line character combination.
And, as far as I understand, Perl will also be clever enough, when reading a file and if detecting that it is working under Windows, to look for "\r\n" combinations as ends of lines, so that the whole thing is in fact transparent to the user: you are using "\n" for record separators and chomp, but Perl knows that it should be understood as "\r\n" if the OS is Windows.
Trouble may occur when processing a Windows-generated file under Unix or vice-versa, but it you're using consistently the OS, Perl will essentially do what you need under the hood, without you even noticing it. So you may think that the Strawberry Perl generated files are Unix-like, but it is most probably not the case.
I think that you need to understand that to figure out how (and whether) you need special processing for your module under Windows.
|