note
romano
Thanks kenneethk
<p>
It took me a while to figure it out. I am putting your response in more explicit terms for neophytes like myself.
</p>
<p>
<code>
$Str1 = "AAAACCCCGGGGTTTT";
$Str2 = "ACGTACGTACGTACGT";
$cmp = $Str1^$Str2;
$cmp |= '0' x length($cmp);
print "$Str1\n";
print "$Str2\n";
print "$cmp\n";
</code>
<code>
**OUTPUT**
AAAACCCCGGGGTTTT
ACGTACGTACGTACGT
0265204764035730
</code>
# What is ‘|=’ doing? This is bitwise ‘or’. Does ‘or’ on left side and right side (right side value is ‘0’ or 00110000). Puts result of ‘or’ in left side. Originally, the value in $cmp for “A” ^ “G” was 00000110 (= 6) – this is ‘Acknowledgement’ – this is not a printable character.
</p>
<p>
By doing the ‘or’ with “0” (00110000 = 48) you convert ‘6’ to ‘6’ + ‘48’ = ‘54’ – this is the value for the character 6. So, $cmp looked empty because all of the values are for non-printable characters.
</p>
<p>
A = 01000001<br />
G = 01000111<br />
^ 00000110 = 6 ‘Acknowledgement’<br />
</p>
<p>
left 00000110 <br />
‘0’ 00110000<br />
| (or) 00110110 = 54 ‘character 6’<br />
</p>
<p>
******************
</p>
<p>
A = 01000001<br />
T = 01010100<br />
^ 00010101 = 21 ‘Negative Acknowledgement’<br />
</p>
<p>
left 00010101 <br />
‘0’ 00110000<br />
|(or) 00110101 = 53 ‘character 5’<br />
</p>
<p>
Thanks again for your help,
</p>
romano (aka KennB)
1038797
1038802