Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: integer value to hex value

by AnomalousMonk (Abbot)
on Dec 05, 2012 at 10:49 UTC ( #1007259=note: print w/ replies, xml ) Need Help??


in reply to integer value to hex value

See hex.

>perl -wMstrict -le "my $i = 100; my $x = hex $i; print $x; printf qq{0x%x \n}, $x; ;; $i = '200'; $x = hex $i; print $x; printf qq{0x%x \n}, $x; " 256 0x100 512 0x200


Comment on Re: integer value to hex value
Download Code
Replies are listed 'Best First'.
Re^2: integer value to hex value
by shyam123 (Initiate) on Dec 05, 2012 at 11:21 UTC
    Hi Anamolous monk,

    Thanks for the reply.But that was not the one i was looking for.If i have a integer say 55667788, i needed to have this as hex value 0x55667788 and not the hex(55667788).Please share your views on it.

    thanks sham

      my $hexstr=sprintf('%x',55667788);

      -- 
      Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007259]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2015-07-29 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls