To directly answer your question, something like this would work:
substr($foo, 14, 10) =~ tr/,/+/; $foo =~ tr/,/\t/; substr($foo, 14, 10) =~ tr/+/,/;
You may need to adjust the substr() arguments to make sure the correct range of characters is being selected. There's no point in testing the company name for commas before converting them to plusses; it's probably just as much work for perl to look for the commas as it would be to go ahead and convert them.

One problem with this is that you may eventually have a company name with plusses in it. Besides that, it's three steps. I'm guessing company names won't have tabs in them, so the following works just as well and is only two steps:

$foo =~ tr/,/\t/; substr($foo, 14, 10) =~ tr/\t/,/;

In reply to Re: Help with substitution - - 15 Characters from the left by kjherron
in thread Help with substitution - - 15 Characters from the left by La12

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.