while ($content =~ /^[\w]+?([VMFWLCA]{8,})[\w]+?$/mg) { my $sequence = $1; print $header, "contains $sequence at position ", pos($content) - +length($sequence), "\n"; }
What did you want "pos($content) - length($sequence)" to give you? The whole pattern starts at 371 and ends at 428 while the contents of $1 start at 416 and end at 424 so 420 is somewhere in the middle of $1. Have a look at the @- and @+ arrays for the start and end positions of matches.
In reply to Re^4: need help with a regex
by jwkrahn
in thread need help with a regex
by aquinom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |