We don't bite newbies here... much | |
PerlMonks |
line ending troublesby Dirk80 (Pilgrim) |
on Dec 21, 2009 at 20:04 UTC ( [id://813753]=perlquestion: print w/replies, xml ) | Need Help?? |
Dirk80 has asked for the wisdom of the Perl Monks concerning the following question: Hi, I want to get rid of the line ending troubles. Until now I had files which had these line endings: 0D 0A (Windows), 0A (Unix), 0D (early MAC). The last file I've seen had mixed MAC and Unix line endings and that was then the reason why my code was not working. I am now seeking for a solution which is reading a file line per line independent of the three line ending types. Also my goal is it that the line ending is chomped, so that I only have the data of each line stored in an array. I tried to solve this with the following code: But the read code is not working and I don't know why. Any hints are welcome. Here I wrote some other code to read the file with the differrent line endings. This code is working.
Although the second solution is working it would be very interesting for me how you would solve this problem and why my slurp code is not working. Thank you very much for your help. Dirk
Back to
Seekers of Perl Wisdom
|
|