my $str1 = 'a11211b123'; my $str2 = 'a11222b123'; my $overlapped = $str1 ^ $str2; $overlapped =~ s/\0/X/g; print $overlapped;