in reply to Dec to Hex (NON-ASCII mode )

Your terminology is very confusing, but it sounds to me like you want the numerical value 6416 aka 10010 from the string "64". For that, you can use hex.

$ perl -E'say 0x64 == hex("64") ?"yes":"no"' yes

In case I misunderstood, here are some other related conversions:

numerical value 6416 from string "64"hex("64")
numerical value 6416 from string "100""100"
packed byte 6416 from numerical value 6416chr(0x64)
packed byte 6416 from string "64"chr(hex("64"))
packed byte 6416 from string "100"chr("100")
string "64" from numerical value 6416sprintf("%X", 0x64)

pack 'C' would work in lieu of chr.

Update: I just noticed your followup. It seems that you want the packed byte 6416 (aka "d" in ASCII), but you didn't specify from what.

$ perl -E'say "\x64" eq chr(hex("64")) ?"yes":"no"' yes $ perl -E'say "\x64" eq chr(0x64) ?"yes":"no"' yes

That could also be written

$ perl -E'say "\x64" eq pack("C", hex("64")) ?"yes":"no"' yes $ perl -E'say "\x64" eq pack("C", 0x64) ?"yes":"no"' yes