for (my $i = 1; $i <= 20; $i++) { $a+=0x0C; $out = pack "c", $a; $hex = unpack "H2", $out; print "\t$i Now, \$a (as decimal) is:\t$a \tand as hex: 0x$hex\n"; }