You could convert your 128 Bytes to a bit-String using regular expressions to match that.
something like
# Warning: Untested code ahead!
# Enter at your own risk!
read($file, $buf, 128);
$bits= unpack("B*",$buf); # or "b*" depending on bit order
do {
if ($r= read($file, $byte, 1)) {
$newbits=unpack("B*",$byte); # or "b*" depending on bit order
$bits.=$newbits;
}
print "match!\n" if $bits=~ /^.{0,7}.{9}0{6}.{35}1{51}.{27}/;
# ^ ^ ^ ^ ^ ^
# possible offset. 0-7 Bit ---/ | | | | |
# match exactly 9 bits -------------/ | | | |
# match Bits 9-14 as 0 -----------------/ | | |
# match 35 Bits to advance to bit 50 -------/ | |
# Bits 50-100 (51 Bits) must match 1 ------------/ |
# to match the last 27 bits of your frame-------------/
$bits= substr($bits,8);
} while ($r);
Not very efficient though.
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.