in reply to how can I speed up this perl??

Ummm, why don't you put the results into a hash instead?
my %freq; ... my $token = $genome[$i] . $genome[$i+1]; $freq{$token}++;
For example, if your input sequence is 'abbca', while you step through the sequence, you will get -
$freq{ab}++; $freq{bb}++; $freq{bc}++; $freq{ca}++;