Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Confusion about code sample in perlfaq4by thundergnat (Deacon) |
on Feb 22, 2013 at 19:36 UTC ( [id://1020211]=note: print w/replies, xml ) | Need Help?? |
The wording does seem to imply that it would return a list of bit values, but that isn't what it is doing. Rather, that routine returns a list of bit positions that are set (have a 1 in them). If you just want the list of bits, it is probably simplest to split an unpacked string.
To furthur demonstrate:
2, 4, 5, 9, 12, 13 <-- bit positions set 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0 <-- bits
In Section
Seekers of Perl Wisdom
|
|