Convert decimal to hex
use integer; $value = 257; while($value) { unshift @digits, (0 .. 9, a .. f)[$value & 15]; $value /= 16; } print @digits;