in reply to How can I set a bit to 0 ?

> What I don't know how to do, nor find on Google,is turn off a specific bit whether it is set or not.

you "mask" (using & the "bitwise-and") with a bitvector which is only 0 if and only if you want to turn off.

DB<22> $in = 0b10101010 + + + DB<23> $mask = 0b11110000 # 1 keep 0 erase + + + DB<24> printf "%b", $in & $mask + 10100000
for more see Mask (computing)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery