Tags Perl
I conveniently encapsulated the whole binary stream issue in a BitStream class. A BitStream object may be created, given a filename, and the user can call a get_bits(N) method to get the next N bits from the file (as a string "010101" etc.) simple and cute. You can read more about it here.

About the implementation - I use the simplest for the moment. When we run into memory problems in our tests, I'll switch to the buffered approach.

Todo... check out this vec() thingie.