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