Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 studying the Monastery: (5)
As of 2015-07-05 06:55 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 (60 votes), past polls