in reply to Re: Double check for positions
in thread Double check for positions

This works, thanks!

But, what do you mean by "I only have one occurrence"? Or explain it a little bit deeper...

And, this line:

pos($sequence) = $newpos;
Why is it needed?

Replies are listed 'Best First'.
Re^3: Double check for positions
by hippo (Archbishop) on Oct 18, 2017 at 13:27 UTC

    I mean that your search pattern GCTTCTTGC only appears once in AGCTTCTTGCGCTTCTT. If you think it appears twice, you are mistaken.

    The pos reset is needed in case there are overlapping pattern matches (which is what I've taken your question to be about, despite the sample data). In that case the pos marker needs to be backtracked to one place after the start of the last match to cope with that.

      Oh yeah, I forgot to remove the one "GC" is my example input... sorry.
        plus add it in the end, as your search pattern ends in 'GC', too