Convert decimal to hex : hex « Data Type « Perl






Convert decimal to hex

   


use integer;

$value = 257;

while($value) {
   unshift @digits, (0 .. 9, a .. f)[$value & 15];
   $value /= 16;
}

print @digits;

   
    
    
  








Related examples in the same category

1.hex("10"), hex("0x10")
2.hex("ab")
3.Illegal Hex number with G
4.Hexadecimal and octal numbers
5.Hexadecimal number
6.Using hex function to convert octal number to Hexadecimal number
7.hex digit
8.hex("FFG")
9.hexadecimal data