string A: 0 1 0 1
string B: 1 1 0 1
| | | |
| | | +--> 11
| | +----> 00
| +------> 11
+--------> 01
####
my @data = qw[
111011001010011110100010100001
111010000010010110000010000001
000101011100001000110101110000
000101111101001001111101111110
111011001010111110100010100001
000100010100000000010001010000
];
use Data::Dumper;
for my $i (0 .. $#data) {
for my $j ($i+1 .. $#data) {
my %counts;
$counts{ substr($data[$i],$_,1) . substr($data[$j],$_,1) }++
for 0 .. length($data[$i]) - 1;
print Dumper \%counts;
}
}
####
for my $i (0 .. $#data) {
for my $j ($i+1 .. $#data) {
my %counts;
my ($str1, $str2) = @data[$i,$j];
$counts{ chop($str1) . chop($str2) }++
while length($str1) and length($str2);
print Dumper \%counts;
}
}