in reply to bit array comparison
The problem is that unpack "b*" takes a string of bytes.
And so does unpack "B*", what you'd use to get the bits in the same order as sprintf "%b".
$ perl -e'CORE::say unpack "B*", pack "L>", 3' 00000000000000000000000000000011
Tip: you should use | rather than + to set a bit (in case it's already set).
$b |= 1 << 2;
|
---|
In Section
Seekers of Perl Wisdom