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

Re: Dec to Hex (NON-ASCII mode )

by samarzone (Pilgrim)
on Dec 09, 2010 at 09:10 UTC ( #876210=note: print w/ replies, xml ) Need Help??


in reply to Dec to Hex (NON-ASCII mode )

sprintf returns a string so if you try to get ascii value of returned string, you get value of character "6" and "4" rather than that of 6 and 4.

Not completely sure what do you want to do but if you want to get a binary representation of 100(dec) in a string you can use "%b"

perl -le '$_ = sprintf("%b", 100);print'

Output:

1100100


Comment on Re: Dec to Hex (NON-ASCII mode )
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-07-10 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (209 votes), past polls