pack and unpack are, as a matter of fact a way to achieve what you want although it's not done in one step:
perl -e 'print join " ", map { chr(ord('A')+eval "0b$_") } unpack "(A5)*", unpack "B*", pack "H*", "139686DA20C1"'
The first transformation is pack "H*", $str where the hexadecimal numbers are turned into binary data.
Then unpack "B*", $str; turns the binary data into a string consisting of the characters '0' and '1'.
unpack "(A5)*", $str; is one of the many ways to split a string every five characters.
Then, packing and unpacking those 5 bits strings into numbers would have been possible, but eval "0b$str" just does that in one step.
chr($nb + ord('A')) is the character at the position "position of A" + $nb. Which is what you want:)
In reply to Re: Handling binary
by Eily
in thread Handling binary
by G109B
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |