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

Re: How to zero-pad hex values in sprintf()?

by blue_cowdawg (Monsignor)
on Jan 18, 2013 at 21:11 UTC ( #1014131=note: print w/ replies, xml ) Need Help??


in reply to How to zero-pad hex values in sprintf()?

      am I crazy or do printf() and sprintf() have no way to return, say, 0F instead of just F?

I'm not a psychiatrist and never played one on TV so I can't judge if you're crazy or not. But check out this sniglet of code.

$ perl -e 'printf "%0.4x\n",128;' 0080


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re: How to zero-pad hex values in sprintf()?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (15)
As of 2015-07-06 20:29 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 (83 votes), past polls