A regex solution might be fairly efficient, since you are looking for a simple word boundary. But I'd suggest using tr+index if making a copy of the $str is not a problem. That might be the fastest as well.
# sub via_rx { $_[0] =~ /.*\b(?<=[ATCG])/s; $+[0] } sub via_rx { $_[0] =~ /.*\w\b/s; $+[0] } sub via_tr { 1+rindex(($_[0] =~ tr/ATCG/X/r), 'X') }
In reply to Re^5: Proper usage of rindex function?
by Anonymous Monk
in thread Proper usage of rindex function?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |