To get the desired result,
>perl -e"printf(qq{%d\n}, unpack('C', pack('h', 'F')));" 15
or
>perl -le"print(hex('F'));" 15
As you can see, the OP has pack and unpack backwards.
In reply to Re^2: Mysteries of unpack
by ikegami
in thread Mysteries of unpack
by atypic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |