Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: printf & sprintf: variable number formats

by flounder99 (Friar)
on Jan 06, 2004 at 19:34 UTC ( [id://319222]=note: print w/replies, xml ) Need Help??


in reply to printf & sprintf: variable number formats

A simple concat works,
$int = 5; printf "%0" . $int . "i", $myInt;
it just isn't as pretty. But it also works with constants
use constant COLWIDTH => 5; $int = 5; printf "%0" . COLWIDTH . "i", $myInt;

--

flounder

Replies are listed 'Best First'.
Re: Re: printf & sprintf: variable number formats
by duff (Parson) on Jan 06, 2004 at 19:41 UTC

    Good point. I should probably have mentioned that very thing about printf "%0*i", $int, $myint; too

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found