<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>You could do something like split into a temp array, scalar the array and if it's not the size you expect, you know your third item had one or more commas. &nbsp;Make your variable assignments for items one and two, then for component 4 (back of the array), you could even use pop and shift for this, then join the remaining elements of the array back together with commas and make your last variable assignment.</div><div><br></div><div>-Scott</div><div><br>On Oct 4, 2013, at 10:19 AM, Erik Mathis &lt;<a href="mailto:erik@mathists.com">erik@mathists.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>Even if you escape the comma, its still goin to slip in the comma.<br><br></div>I'd just remove the comma, or change it to something else.<br><br>#!/usr/bin/perl -w<br>use Data::Dumper;<br>$String='component1,component2,"This is my, test string", component4';<br>
print $String,"\n";<br>$String =~&nbsp; s|"(.+),(.+)"|$1$2|;<br>print $String,"\n";<br>print Dumper split(',', $String);<br><br>emathis@emathis-lappy:~$ perl /tmp/<a href="http://123.pl">123.pl</a> <br>
component1,component2,"This is my, test string", component4<br>component1,component2,This is my test string, component4<br>$VAR1 = 'component1';<br>$VAR2 = 'component2';<br>$VAR3 = 'This is my test string';<br>
$VAR4 = ' component4';<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 3, 2013 at 6:08 PM, Jim Kinney <span dir="ltr">&lt;<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Unless you have a magical way to escape the comma inside the quoted string, you're stuck. sed 's/\(".\+\),\(.\+"\)/\1\\,\2/g' file. Assuming all intermediate strings will be double quoted.<br>

<br></div>Might try splitting to an array instead of individual string vars. Then you can do a length test to see if you got something "extra".<br>@strings = split(',' , $String);<br><br></div><div>Be sure to empty the array after each run or loop it as a local variable created each pass.<br>

</div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Oct 3, 2013 at 5:22 PM, Robert L. Harris <span dir="ltr">&lt;<a href="mailto:robert.l.harris@gmail.com" target="_blank">robert.l.harris@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><br></div>*Sorry for the OT but my only perl lists have gone dark a long time ago*<div>
<br></div><div>
<br></div><div>$String='component1,component2,"This is my, test string", component4';</div>

<div><br></div><div>($C1, $C2, $Str, $C4) = split(',', $String);</div><div><br></div><div>I'm only getting "This is my" in $Str and $C4 does not contain "component4". &nbsp;Is there a graceful way of handling this? &nbsp;It's a 1 in 10000 chance it'll break but accuracy counts.</div>

<span><font color="#888888">

<div><br></div><div>Robert</div><div><br clear="all"><div><br></div>-- <br>:wq!<br>---------------------------------------------------------------------------<br>Robert L. Harris<br><br>DISCLAIMER:<br>&nbsp; &nbsp; &nbsp; These are MY OPINIONS&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; With Dreams To Be A King,<br>



&nbsp; &nbsp; &nbsp;&nbsp; ALONE.&nbsp; I speak for&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; First One Should Be A Man<br>&nbsp; &nbsp; &nbsp;&nbsp; no-one else.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; - Manowar
</div></font></span></div>
<br></div></div><div class="im">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr">-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>Every time you stop a school, you will have to build a jail. What you 
        gain at one end you lose at the other. It's like feeding a dog on his 
        own tail. It won't fatten the dog.<br>

        - Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br></i></i></i></i></div>
</font></span></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Ale mailing list</span><br><span><a href="mailto:Ale@ale.org">Ale@ale.org</a></span><br><span><a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a></span><br><span>See JOBS, ANNOUNCE and SCHOOLS lists at</span><br><span><a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a></span><br></div></blockquote></body></html>