#!/usr/bin/perl-w use strict; use Data::Dump qw[ pp ]; my $a="AGAGATATTCAAATT"; my $b="TCGAACGTCGAG"; my (%first,%second,%third); my @trilet1 = $a =~ /.../g; my @trilet2 = $b =~ /.../g; use Data::Dump qw[ pp ]; Code????? for my $p ( 0 .. length( $seq1 ) - 1 ) { my $c1 = substr $seq1, $p, 1; my $c2 = substr $seq2, $p, 1; next if $c1 eq $c2; ++$subs{ $c1 . '2' . $c2 }; } pp \%first,%second, %third; exit;

The result should look like:

Counting Results: { For 1st position of all 3-letter words: A2T=> 1, G2A=> 1, A2G=> 1, C2G=> 1, For 2nd position of all 3-letter words: G2C=> 1, For 3rd position of all 3-letter words: A2G=> 2, T2C=> 2, }