I found this post on-line and I am not clear exactly what is going on.
you will get a string of bytes with values zero and one, rather then the characters '0' and '1'. To make this printable just 'or' in a string of zeroes of the right length.
$dd |= '0' x length $dd
I know what the result of this statement is but I am not sure exactly what (how) it is doing (it). I am comparing 2 strings (^) and when I do
$cmp |= '0' x length($cmp); # See rest of code below.
numbers magically appear and I can then see (print) what is in $cmp. So, what exactly does or in a string of zeroes mean? Zeroes appear but so do other digits (A ^ C → 2). What does |= do? (or |= 0) Is there some substitution occurring?
My code:$Str1 = "AAAACCCCGGGGTTTT"; $Str2 = "ACGTACGTACGTACGT"; $cmp = $Str1^$Str2; $cmp |= '0' x length($cmp); print "$Str1\n"; print "$Str2\n"; print "$cmp\n";
**OUTPUT**
AAAACCCCGGGGTTTT
ACGTACGTACGTACGT
0265204764035730
grazie,
romano
In reply to bitwise string operator by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |