<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">it seems that all line end with carriage return character (ascii octal num 15) only. There is no line feed (newline character in Unix)<br><br>I made one in Linux and you can see the difference:<br><br><span style="font-family: courier,monaco,monospace,sans-serif;">gpeng@linbay:/home/gpeng/perl</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">-> perl -ne 'print $_' 2.csv</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">WLANE_02,51,3.2,55,60,32,19,0,0,17.6,17.1,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span
style="font-family: courier,monaco,monospace,sans-serif;">gpeng@linbay:/home/gpeng/perl</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">-> perl -ne 'print $_,"\n"' 2.csv</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">WLANE_02,51,3.2,55,60,32,19,0,0,17.6,17.1,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">gpeng@linbay:/home/gpeng/perl</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">-> perl -015 -ne 'print $_,"\n"' 2.csv # use carriage character as recorder separator</span><br style="font-family:
courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">Header</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">RLANE_02,16,0.6,54,58,16,0,0,0,56.3,55.9,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">RLANE_01,8,0.3,56,59,8,0,0,0,112.5,112.2,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">ELANE_02,60,3.9,56,61,32,28,0,0,15,14.4,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">ELANE_01,23,1.3,60,65,13,10,0,0,39.1,38.6,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span
style="font-family: courier,monaco,monospace,sans-serif;">WLANE_01,10,0.3,57,58,9,1,0,0,90,89.7,11/1/2007,0:00:00,,</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">WLANE_02,51,3.2,55,60,32,19,0,0,17.6,17.1,11/1/2007,0:00:00,,</span><br><br><br>gpeng@linbay:/home/gpeng/perl<br><br><br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Eric Ellington <e.ellington@gmail.com><br>To: Chicago.pm chatter <chicago-talk@pm.org><br>Sent: Thursday, December 13, 2007 10:07:50 PM<br>Subject: Re: [Chicago-talk] Why does Perl hate my csv file?<br><br>
I am creating everything on a windows system. I checked the line<br>endings and they look OK to me. Like I said the file works with any<br>other extension besides csv. Giving it .123 worked.<br><br>The output is jacked up in the windows cmd terminal, all of the output<br>is printed on the same line. I can watch it overwrite it self and then<br>I just get some data smashed<br>onto one line.<br><br>Cut and Pasted:<br>,,,,,,,,,,,,1,42,44,2,0,0,0,450,449.7,12/1/2007,3:00:0000<br><br>This is a scaled down version of something larger. However, I am<br>having the exact same problem with the code I posted and I am just<br>testing with a different file which I attached to this email. If there<br>are any weird characters I am not sure what they are or how they are<br>messing things up. I see nothing but CR's on every line and one LF on<br>the final line.<br><br>I also turned on use warnings but got no warnings.<br><br>On Dec 13, 2007 6:49 PM, Andy Lester <<a
ymailto="mailto:andy@petdance.com" href="mailto:andy@petdance.com">andy@petdance.com</a>> wrote:<br>><br>> On Dec 13, 2007, at 6:46 PM, Eric Ellington wrote:<br>><br>> > Change the file name to 1.txt and I get output or if I comment out
"my<br>> > $x = <FILE>;" and even then the output is jacked up. Why is that?
Does<br>> > open do something special when it sees a file that ends in .csv? I<br>> > found nothing at <a href="http://perldoc.perl.org/functions/open.html" target="_blank">http://perldoc.perl.org/functions/open.html</a> or on<br>> > ActiveState's website.<br>><br>><br>> No, Perl doesn't care at all. There's something else going on that<br>> you're not describing. Are the line-endings different for your<br>> machine from the machine that you got the file from? You're on Unix<br>> and it came from Windows, or vice versa?<br>><br>> Also, although "use strict" is a good thing, even more important is<br>> "use warnings".<br>><br>> Throw that in and see what else happens. And what does "the output
is<br>> jacked up" mean, anyway?<br>><br>> xoox,<br>> Andy<br>><br>> --<br>> Andy Lester => <a ymailto="mailto:andy@petdance.com" href="mailto:andy@petdance.com">andy@petdance.com</a> => <a target="_blank" href="http://www.petdance.com">www.petdance.com</a> => AIM:petdance<br>><br>><br>><br>><br>> _______________________________________________<br>> Chicago-talk mailing list<br>> <a ymailto="mailto:Chicago-talk@pm.org" href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>> <a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>><br><br><br><br>-- <br>Eric Ellington<br><a ymailto="mailto:e.ellington@gmail.com" href="mailto:e.ellington@gmail.com">e.ellington@gmail.com</a><br></div><br></div></div></body></html>