Reputation: 467
I need to convert a number to hex in perl. I'm using the following simple code:
my $n = 10;
print sprintf("%X", $n);
That will output: A That's correct, but I need always 2 bytes like: 0A
So for example: 90 will show 5A - 6 will show 06 - 10 will show 0A
How can I do that?
Upvotes: 4
Views: 4270