<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
I think what you're looking for is something like this:<br>
<blockquote><tt>$cnt = 6;<br>
$piece =~ s/(?&lt;!\")\t/\"\t\"/ while $cnt--;</tt><br>
</blockquote>
This will substitute the first six tabs with quoted tabs.&nbsp; The
(?&lt;!\") business is a "<i>zero-width negative look-behind assertion</i>"
that says it should only match tab chars that are not immediately
preceded by a quote char (but the quote char is not included in the
text to get substituted).&nbsp; since there is no /g modifier on the
substitution, we have to do it all with an in-line while loop
constrained by <tt>$cnt</tt>.<br>
<br>
Tim.<br>
<br>
Barron Snyder (CE CEN) wrote:
<blockquote
 cite="mid28CEB74C14F56548BC3F1504129E99F50149D1EC@wfm-exchprd5.wfm.pvt"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
  <o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
  </style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  </o:SmartTagType>
  <div class="Section1">
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">$piece =~ s/\t/\"\t\"/g;<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">With the above code I&#8217;m
searching for all tab
characters and replacing them with a tab surrounded by double-quotes.
Is there
a way without putting this in a coding loop, to replace say, only the
first three
instances it finds in $piece? It seems like a nice way to do this would
to be
able to replace the &#8220;g&#8221; with an integer indicating how many
replacements to do but it doesn&#8217;t seem to work like that &lt;grin&gt;.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I&#8217;m parsing some columnar
data (7 columns) and I want
to put double-quotes around the first six columns. I&#8217;ve figured out a
way
to do it but it&#8217;s kind of clumsy. I thought you experts may be able to
show a Perl newbie a more elegant way to do it.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Thanks,<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoAutoSig" style="margin: 0in 0in 0.0001pt;"><st1:PersonName
 w:st="on"><font color="black" face="Tahoma" size="1"><span
 style="font-size: 8pt; font-family: Tahoma; color: black;">Barron
Snyder</span></font></st1:PersonName><o:p></o:p></p>
  <p class="MsoAutoSig" style="margin: 0in 0in 0.0001pt;"><font
 color="black" face="Tahoma" size="1"><span
 style="font-size: 8pt; font-family: Tahoma; color: black;">Software
Development, Financial Systems Team</span></font><o:p></o:p></p>
  <p class="MsoAutoSig" style="margin: 0in 0in 0.0001pt;"><b><font
 color="black" face="Tahoma" size="1"><span
 style="font-size: 8pt; font-family: Tahoma; color: black; font-weight: bold;">Whole
Foods Market, HQ</span></font></b><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Tahoma" size="1"><span
 style="font-size: 8pt; font-family: Tahoma; color: black;"><a
 href="mailto:barron.snyder@wholefoods.com">barron.snyder@wholefoods.com</a></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">&nbsp;<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="1"><span
 style="font-size: 8pt; font-family: Arial; color: navy;">This email
contains proprietary and
confidential material for the sole use of the intended recipient. Any
review,
use, distribution or disclosure by others without the permission of the
sender
is strictly prohibited. &nbsp;If you are not the intended recipient (or
authorized to receive for the recipient), please contact the sender by
reply
email and delete all copies of the message.</span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Austin mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Austin@pm.org">Austin@pm.org</a>
<a class="moz-txt-link-freetext" href="http://mail.pm.org/mailman/listinfo/austin">http://mail.pm.org/mailman/listinfo/austin</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
 _______________________________________________________________________
                                                      Timothy E. Peoples
                                                   Have Camel, Will Code
                                                         <a class="moz-txt-link-abbreviated" href="mailto:tim@toolman.org">tim@toolman.org</a>

</pre>

<DIV><P><HR>
This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.
</P></DIV>
</body>
</html>