Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: PERL Binary Data Handlingby ashes3d (Initiate) |
on Oct 05, 2012 at 23:23 UTC ( [id://997554]=note: print w/replies, xml ) | Need Help?? |
Thank you both for the response! To elaborate on my question, let's assume that the input file contains a binary number of: "0101_1111_1111_0000_0111_0000_1111_1010" Output should be: "1_0101_1111_1111_0000_0111_0000_1111_1010" This is purely binary input. I only added the "_" for readability. I understand that we cannot write a file on non byte boundaries. So if I would always have 7 extra bits when this is written to the file. This would mean that my output file will look like: "0000_0001_0101_1111_1111_0000_0111_0000_1111_1010" When I run the code below, I get an output of: "0000_0001_0000_0000_0000_0000_0000_0000_0000_0000" I think I am still misusing the pack command. What am I missing? Code below:
In Section
Seekers of Perl Wisdom
|
|