$sequence = "caggaacttcccctcggaagaccatgta";
I want to count the number of occurrences of each pair of letters, for example:
Number of occurrences of "aa" Number of occurrences of "gt" Number of occurrences of "cc"
This is how I'm counting the number of "cc" pairs at the moment ($cc is my counter variable):
$cc++ while $sequence =~ /cc/gi;
But this only matches the literal string "cc", so if, as it scans $sequence, it finds "cccc" it's only counting it once instead of three times.
What pattern do I need to be looking for in the $sequence if I want to count *all* occurences of "cc" -- even if they overlap?
I apologise if this is an already documented problem, I've tried a number of Google Groups searches, as well as searches on learn.perl.org, but without finding an answer.
Many thanks for any help offered.
Henry.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>