APM: Regular Expression Question

Barron Snyder (CE CEN) Barron.Snyder at wholefoods.com
Wed Aug 16 07:32:57 PDT 2006

$piece =~ s/\t/\"\t\"/g;


With the above code I'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 "g" with an integer indicating how many
replacements to do but it doesn't seem to work like that <grin>.


I'm parsing some columnar data (7 columns) and I want to put
double-quotes around the first six columns. I've figured out a way to do
it but it's kind of clumsy. I thought you experts may be able to show a
Perl newbie a more elegant way to do it.




Barron Snyder

Software Development, Financial Systems Team

Whole Foods Market, HQ

barron.snyder at wholefoods.com


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.  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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20060816/1e2b749f/attachment.html 

More information about the Austin mailing list