Here are two ways to convert from decimal to hexadecimal.
Using sprint
$DEC = 32043;
$HEX = sprintf ("%X", $DEC);
print "$DEC decimal equals to $HEX hexadecimal \n";
Using unpack
$string="One OS to rule them all, One OS to find them, One OS to bring them all and in the darkness bind them.";
$out = unpack("H*",$string);
print "The string in HEX \n";
print "$out\n";
So, now how to convert back form hexadecimal to decimal?
No comments:
Post a Comment