Hi<br>So i played with Text::CSV, Text::XS and Text::xSV last night and got thoroughly lost :-). each one having its different confusing points.. each one saying that they support embedded newlines, each without an explanation that i understand. If anyone can point me to an example i would be in your debt. I have been beating my head against the wall for 30 or more hours on this problem..and its making me question basic simple little things in perl... which isn&#39;t good.<br>
<br>Nothing like a simple problem to humble you :-)<br><br>I started thinking about it this morning, essentially what i need is .. when the file is read in i need it to not be broken up by the interpretation of the newline characters.<br>
<br>I read up on the $/ &quot;slurp&quot; variable.. which seems to do what i need it to do.. not interpret the newlines when taking the data in<br><br>I am having a tough time coming up with a regex (i seriously need to sit down for a week and work through/understand perl regexes) that will match all occurrences of characters with an embedded newline surrounded by quotes...<br>
<br>essentially like i have in the following (FIND OPEN QUOTE) could be something like /&quot;(.*)&nbsp; match a quote, followed by any character except newline, multiple times ... then a \n&nbsp; and then ?????&nbsp; find any character except newline, multiple times and then ending with a quote.<br>
This wont take into account things that are not wrapped in quotes or things in quotes with multiple newlines.. which makes me want to lean towards using a module and not reinventing the wheel. I am going to sit down and reread the perldocs for Text::xSV.<br>
<br>#!/usr/bin/perl<br><br>local $/;<br>$words=&lt;DATA&gt;;<br><br>$words=~s/ (FIND OPEN QUOTE) \n (FIND CLOSE QUOTE) / $1 $2 /&nbsp;&nbsp; ;<br>print &quot;$words&quot;;<br><br>__DATA__<br>qwert,&quot;yuiop&quot;,&quot;asdf12 34jkl&quot;,&quot;zxcvbnm&quot;<br>
&quot;mnbv&quot;,&quot;vcxzlk&quot;,jhgfdsa,&quot;poiuy&quot;<br>&quot;poiuyt&quot;,&quot;trewq&quot;,kjhtfdrseaw,kikujy 78886 htgrfed<br><br>Thanks<br>Mike<br><br><br><div class="gmail_quote">On Wed, Apr 9, 2008 at 3:47 PM, Mike Ferrari &lt;<a href="mailto:mikeferrari8@yahoo.com">mikeferrari8@yahoo.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">I was playing with Text::CSV_XS .. and got lost.. seriously.. although it did claim it could handle &quot;embedded newlines&quot; which i now know is the term for the thing thats killing me..&nbsp; i couldn&#39;t get it to handle embedded newlines even in binary mode.<br>

I will play with Text::xSV tonight to see what i come up with.. <br><br>With all the different &quot;csv&quot; parsing modules out there.. you would think there would be a push for one big/good one to use with good docs and examples... Instead of 10 different ones you load on special cases with mediocre docs and examples..<br>

<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div><br><div class="gmail_quote">On Wed, Apr 9, 2008 at 3:37 PM, Andrew Rodland &lt;<a href="mailto:arodland@comcast.net" target="_blank">arodland@comcast.net</a>&gt; wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>On Wednesday 09 April 2008 01:44:46 pm Mike Ferrari wrote:<br>
&gt; It just so happens that some of the data has a CRLF smack in the middle<br>
&gt;<br>
&gt; I am using Text::CSV for the first time and am liking the power to deal<br>
&gt; with the commas and quotes and stuff.. but i am having problems with the<br>
&gt; CRLF in the middle of the data.<br>
&gt;<br>
&gt; The perldoc page says if you run into non ASCII characters use binary<br>
&gt; mode.. but the CRLF isn&#39;t non ASCII.<br>
&gt;<br>
&gt; Whats the most normal/easiest way to deal with CRLF in the data without<br>
&gt; screwing up the normal end of line? I need to sanitize the data somehow and<br>
&gt; am drawing a blank.<br>
&gt;<br>
<br>
<br>
</div>Try Text::xSV, it&#39;s less blatantly line-based than Text::CSV, and it copes<br>
with that sort of thing better. Besides, I think the interface is more sane.<br>
<font color="#888888"><br>
Andrew<br>
</font><div><div></div><div>_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org" target="_blank">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></div></blockquote></div><br><br clear="all"><br></div></div><div><div></div><div>-- <br>/dev/mike0<br><br><a href="http://www.mikeferrari.com" target="_blank">http://www.mikeferrari.com</a>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>/dev/mike0<br><br><a href="http://www.mikeferrari.com" target="_blank">http://www.mikeferrari.com</a>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>/dev/mike0<br><br><a href="http://www.mikeferrari.com">http://www.mikeferrari.com</a>