You only use printf() if you are trying to format the output to the
screen or a file.  In most cases Luke's suggestion of using sprintf() is
the way to go.

 



-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of JeeBee
Sent: Thursday, December 15, 2005 2:13 PM
To: beginners@perl.org
Subject: Re: Equal length ID numbers


Yeps, use the printf function, something like this:
$ perl -e 'printf("%04d\n", 1);'
0001

JeeBee.


On Thu, 15 Dec 2005 14:42:46 +0100, Andrej Kastrin wrote:

> Hi all,
> 
> Suppose that we have numbers 1 to 1000 and we want all numbers be
equal
> lengh; e.g.:

<snip>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to