Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
As bit vectors have already been addressed, this is only in regard to masking.
You will first need to construct a bitstring for the mask. my $mask = pack("b*","01000000"); Will create a bitstring, least significant bit first, which is the order defined by vec(), with the appropriate mask. Next you supply a bitwise operator: & in your case. my $result = $mask & $array Finally, you must check the bit again with vec(). if (vec($result,1,1)){ }; # A exists in slot 1 Unless you've used integers instead of bitstrings, in which case unless all the bits are false the value will be true. -nuffin zz zZ Z Z #!perl In reply to Re: Binary data type?
by nothingmuch
|
|