in reply to converting ASCII hex into binary
As an example, the string "0x0102" should become two bytes where the MSB byte is 0x01 and LSB byte is 0x02
$string =~ '0x0102'; $output = hex($string); print($output); # 258 (0x0102)
Or did you want "\x01\x02":
$string =~ '0x0102'; $output = pack('H*', substr($string, 2)); print($output); # "\x01\x02"
|
|---|