|P is for Practical|
Printing a int as hexby Dr Manhattan (Beadle)
|on Sep 09, 2013 at 18:54 UTC||Need Help??|
Dr Manhattan has asked for the
wisdom of the Perl Monks concerning the following question:
I'm having some trouble in printing a hash value (normal integer) as a hexadecimal value. This value has to be small caps, and 2 digits long
When I do a simple script like this to test the code:
-it works perfectly fine
In the example code I try to print a hash value(which is a normal integer) as a hex value. I am using the printf and hex functions, but somehow I get stuck. For instance if my hash value is 10, I want the output to be 0a. All I get back though is normal ints.
Thanks in advance for any help, much appreciated
But when I try to implement that in my real script, it does not work
Somehow it filters out all values larger than 10 from my output. This is strange because the code is the same...