Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
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
$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
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 ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I need Hex conversion, not!
by Corion (Patriarch) on Jan 07, 2013 at 13:04 UTC | |
|
Re: I need Hex conversion, not!
by LanX (Saint) on Jan 07, 2013 at 13:06 UTC | |
|
Re: I need Hex conversion, not!
by choroba (Cardinal) on Jan 07, 2013 at 13:31 UTC | |
by Anonymous Monk on Jan 07, 2013 at 17:34 UTC | |
|
Re: I need Hex conversion, not!
by blue_cowdawg (Monsignor) on Jan 07, 2013 at 13:09 UTC | |
|
Re: I need Hex conversion, not!
by tobyink (Canon) on Jan 07, 2013 at 16:18 UTC | |
by Anonymous Monk on Jan 07, 2013 at 17:17 UTC | |
by tobyink (Canon) on Jan 08, 2013 at 09:33 UTC | |
|
Re: I need Hex conversion, not!
by AnomalousMonk (Archbishop) on Jan 07, 2013 at 22:54 UTC | |
by Anonymous Monk on Jan 09, 2013 at 09:29 UTC | |
|
Re: I need Hex conversion, not!
by Anonymous Monk on Jan 07, 2013 at 13:44 UTC | |
by moritz (Cardinal) on Jan 07, 2013 at 13:48 UTC | |
by BrowserUk (Patriarch) on Jan 07, 2013 at 14:05 UTC | |
by Anonymous Monk on Jan 07, 2013 at 14:16 UTC | |
by BrowserUk (Patriarch) on Jan 07, 2013 at 14:38 UTC | |
by Anonymous Monk on Jan 07, 2013 at 16:15 UTC | |
by Corion (Patriarch) on Jan 07, 2013 at 14:17 UTC | |
by Anonymous Monk on Jan 07, 2013 at 16:17 UTC | |
|