in reply to Modifying multiple bits in a byte - bitwise operators
Another way:
c:\@Work\Perl\monks>perl -wMstrict -le "my $x = 0b10001010; my $target = 0b10001101; ;; my $mask = $x ^ $target; ;; my $result = $x ^ $mask; printf qq{0b%b \n}, $result; ;; die qq{target $target != result $result} if $target != $result; " 0b10001101
Give a man a fish: <%-{-{-{-<
|
|---|