|
Posted by A. Sinan Unur on May 1, 2008, 10:50 pm
Please log in for more thread options
benkasminbullock@gmail.com (Ben Bullock) wrote in
>
>> Well, if one uses the solution you proposed above and the list of
>> data to swap changes to
>>
>> my %subst = qw( A|C C|A G|U U|G );
>>
>> there will be issues with the way you build the search string.
>
>> my $search = join ('|', map { "(?:\Q$_\E)" } keys %replace);
>
> So you agree that the lookup table driven solution isn't simple?
>
> I think my original method of substituting in an unlikely string,
> which you objected to, was fairly appropriate for this particular
> question. I often use this kind of method for quick jobs.
Yes. That was the first thing in my response: 'Granted'.
OTOH, the number of repeated substitution operations which the 'unlikely
string' approach requires (especially as the number of
lookups/replacements grows) makes me think that the more complex
approach might end up being simpler to maintain for any 'durable'
program.
Thank you for your corrections.
Sinan
--
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
|