in reply to Re: perl bitology - breaking into bytes
in thread perl bitology - breaking into bytes

The problem is deeper... My examples were just figurative, as a matter of fact, a frame is valid when certain single bits are 1, with no relations between them.

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.

  • Comment on Re: Re: perl bitology - breaking into bytes