CpG counter

use strict;
use Bio::SeqIO;
use Data::Dumper; 

my $filename="promoter.txt";
my $sequence_object; 

my $seqio = Bio::SeqIO -> new   (                                
'-format' => 'fasta',  
'-file' => $filename);

while ($sequence_object = $seqio -> next_seq) {
#print Dumper($sequence_object);
my $sequentie = $sequence_object-> seq();
print $sequentie."\n";
#last;
my $count=$sequentie=~ s/CG/CG/g;
print "$count\n";
}