How can I convert a number, $d = 1024, in decimal to 0xFF in hex in Perl?
$d = 1024
The d variable needs to be assigned to a different variable and b
d
1024 in decimal is not 0xFF in hex. Instead, it is 0x400.
1024
0xFF
0x400
You can use sprintf as:
my $hex = sprintf("0x%X", $d);