in reply to Help with substitution - - 15 Characters from the left
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.substr($foo, 14, 10) =~ tr/,/+/; $foo =~ tr/,/\t/; substr($foo, 14, 10) =~ tr/+/,/;
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/,/;
|
|---|