for my $seq ($_[0]->seq()) { # in case you need to reset the first match position # (avoid pos() on huge strings) # $seq =~ /\za/g; $CG++ while $seq =~ /CG/g; } #### my $seq = $_[0]->seq();