in reply to How to get hexadecimal output in specific format?

Please use code tags around any example code, it will make your questions easier to read.

Here is a slight tweak of your code that should do what you want.

use strict; use warnings; my $dec = 1211; print "Hexadecimal number: ", uc(sprintf("%08x\n", $dec)), "\n";