programming-examples/perl/Datatype/Convert decimal to hex.pl

11 lines
141 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use integer;
$value = 257;
while($value) {
unshift @digits, (0 .. 9, a .. f)[$value & 15];
$value /= 16;
}
print @digits;