in reply to Re: perl bitology - breaking into bytes
in thread perl bitology - breaking into bytes
There's a quite straightforward solution to the problem: read the file, unpack() it into a nice string of 1s and 0s, and work on it. Perl likes nice strings.
However, this results in a peformance and memory problem. The file may get huge (100 MB), hence the string of 1s and 0s is 800 MB (each bit is represented by a char), which easily throws my PC out of memory.
However, I don't see another way... Digging in bits directly, w/o unpacking them to a string is extremely difficult.
I might just go for the string solutions, but will solve the memory problem by not having the whole string in memory, but only some buffer. Messy, but it should work, I hope.
|
|---|