Just another Perl shrine | |
PerlMonks |
Re: Eating RAM problemby crenz (Priest) |
on Aug 01, 2002 at 20:01 UTC ( [id://186914]=note: print w/replies, xml ) | Need Help?? |
Bytes always consist of 0's and 1's. ;-) Frankly speaking, I am not sure I understand you here. Let me rephrase: For each block of n bytes, you are going to replace it by a number of m bytes; m>n. Your input data and output data are files consisting of 0's and 1's. I don't understand why, but I accept that. Is that correct? If yes, you can perform any mathematical operations with any of the following three representations of the data:
These three representations are equivalent; you just need to use different syntax to access them. For example, to access the third bit in the data, you would use
To access whole bytes or blocks of bytes, you would use splice, substr and substr, respectively. All the operations you will need to perform can be expressed in all three data representations -- but the last one will only use 2M of memory... Plus, for the last one, you can use perl's binary or, and etc, whereas for the @list and $bitstring, you'll have to emulate the mathematical functions (using the abovementioned substr, vec etc.)
In Section
Seekers of Perl Wisdom
|
|