<?xml version="1.0" encoding="windows-1252"?>
<node id="1012021" title="I need Hex conversion, not!" created="2013-01-07 08:01:06" updated="2013-01-07 08:01:06">
<type id="115">
perlquestion</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I need to use hex numbers for something but when I assign hex number to something, it prints out as decimal. I do not want that and I do not want to waste my code as re-convertion &lt;/p&gt;

&lt;code&gt;
$SM = 0xFE;

print $SM, "\n" ;

#it prints out 254
#but of course if I write it like this;

printf("0x%02X",$SM);

#it prints out 0xFE
&lt;/code&gt;
&lt;p&gt;I want to use many variables like $SM, so I dont want to write "0x%02X", etc. everywhere. I need direct output in hex, or even better, only hex part like, FE, so what should I do ? &lt;/p&gt;</field>
<field name="reputation">
5</field>
</data>
</node>
