I've never dealt with complicated matching before, so I definitely need a little assistance on this one!
I'm taking a frame in and need to break it down into a packet. This isn't a problem, except I've no idea how to split my frame into the necessary pieces to work with. The frame begins & ends the same way, has a 16-character byte count section, and then the mystery 'payload'. It would look something like this
flag byte count mystery flag
01111110 0000000000000100 010111001001 01111110
The only parts I'm *sure* of every time I get a frame is the flag sections on either end, and the length of the byte count is always 16.
I want to be able to split this frame when I get it into 4 parts, flag1, bytecount, mystery, flag2. What kind of pattern would I be matching for? Splitting against whitespace isn't an option, the frame only comes in one long piece. Having a variable like the mystery section in a string is something I've never had to work with before, hence my need for guidance from those more experienced than I
I do have the Programming Perl book, if someone can direct me to an example in there that might assist me.
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.