in reply to PERL Binary Data Handling
First of all, I want to congratulate you, as a newbie, for utilizing code tags :).
- While you may want 33 bits worth of data, when you write it, it will be 40-bits worth of data. You would be best served by explicitly defining all 40 bits in your pack operation
- pack takes string parameters. You're reading in a binary value, and passing that as the argument to pack. To do what you want, you should my $str = unpack ("b32", $buff); and then use $str as the second arg
- You probably want to use syswrite to do your output, rather than print
fnord
In Section
Seekers of Perl Wisdom