[Bioperl-l] A perl regex query

Chris Fields cjfields at uiuc.edu
Tue Sep 18 14:23:37 EDT 2007

On Sep 18, 2007, at 12:21 PM, Sendu Bala wrote:

> bioperl-list at superfrink.net wrote:
>> On Tue, 18 Sep 2007, Nathan Haigh wrote:
>>> An even better way is to use the array as Spiros suggested, but you
>>> should then be able to use that in the regex like this:
>>> my @ra_bad_terms = (  '-D-', 'Cyclic-' );
>>> $string =~ s/@ra_bad_terms//g;
>> I didn't know one could do that.  I couldn't get it to work so I  
>> asked
>> around.  In case anyone else read it and thought about using that  
>> code it
>> might only work in Perl 6.
> I assumed it was a typo. You can get it to work by adding
> $" = '|';
> before the regex;

Ah, didn't know that one.  Nice, though shouldn't it be localized?

The (supposed) advantage of Regexp::List is the regex is optimized  
for speed; I haven't tried it out myself, so YMMV.


More information about the Bioperl-l mailing list