Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Extracting Bit Fields (Again)by BrowserUk (Patriarch) |
on Oct 12, 2005 at 04:26 UTC ( [id://499368]=note: print w/replies, xml ) | Need Help?? |
Here is one way to do it (but you aren't going to like it!):
To explain that, (right-to-left):
The problem with vec is that it only allows you to deal with bits in quantites that are powers of 2, and on powers of two boundaries, which makes dealing with your 3-bit field problematic. Probably easier to use is a subroutine like this:
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
In Section
Seekers of Perl Wisdom
|
|