general answers:
> 1. How can I read the file from disk?
use sliding window technique, you only need to hold at least twice the searched string in memory. see length argument in read
Though multiples of 4kb big chunks seems reasonable.
> And then 2nd how would I do a regular expression for binary instead of searching for text?
strings are just binaries, you just need to convert¹ your hex to them.
BTW: index may be a good alternative to regex
¹) e.g.
DB<115> join "", map {chr} 0x20,0x41,0x42
=> " AB"
see also pack for a direct approach.
DB<123> pack 'H*', '204142'
=> " AB"
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.