in reply to Converting Binary Numbers into Binary File
A word of caution: Be sure you understand what the numbers are, and what is going to be reading that binary file.
There are several ways of interpreting that asciized binary, and several ways that they could need to be packed depending upon the target platform. Here are a few interpretations:
print unpack 'n', pack 'B*', $_ for qw[ 0010010010011001 1110101010100 +101 ];; 9369 60069 print unpack 'n', pack 'b*', $_ for qw[ 0010010010011001 1110101010100 +101 ];; 9369 22437 print unpack 'v', pack 'b*', $_ for qw[ 0010010010011001 1110101010100 +101 ];; 39204 42327 print unpack 'v', pack 'B*', $_ for qw[ 0010010010011001 1110101010100 +101 ];; 39204 42474
|
|---|