The problem seems a tad underspecified, making it harder to suggest an approach that's likely to be appropriate. How many bits would make up the target pattern? Would the target pattern always be the same number of bits? Suppose you have a 6-bit target pattern, and it matches the input starting at, say, the 27th bit. At exactly what bit offset does the first output nibble begin? (i.e. do you have to "re-align" the nibble/byte boundary relative to the start of the matched pattern, or will it be okay for the output to remain byte-aligned relative to the start of the input stream?)
Details aside, it does seem as though Bit::Vector will be a good thing to use -- it has everything you need, and plenty more that you will probably never need. But when fiddling with bits, one thing you need most is a detailed spec for what your intentions are.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.