I find it difficult to get all the details right using the procedure that FishMonger outlined. The data structure that you describe is a bit-vector, not a number. You may be able to exploit this by using the built-in function vec. (Refer: perldoc -f vec) to both set and read the bits. Good Luck, Bill