How to add leading zeros?

2005-02-16 Thread Bastian Angerstein
Hello, I have some Numbers 1 2 3 40 51 and I want them to be in the format 001 002 003 ... 040 ... 051 ... What is the fastest way to do this?? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to add leading zeros?

2005-02-16 Thread Ing. Branislav Gerzo
Bastian Angerstein [BA], on Wednesday, February 16, 2005 at 13:28 (+0100) wrote the following: BA> I have some Numbers 1 2 3 40 51 and I want them to be in the format BA> 001 002 003 ... 040 ... 051 ... perldoc -f printf perldoc -f sprintf printf("%03.d", 50); -- ...m8s, cu l8r, Brano. [S

Re: How to add leading zeros?

2005-02-16 Thread Ankur Gupta
Bastian Angerstein wrote: Hello, I have some Numbers 1 2 3 40 51 and I want them to be in the format 001 002 003 ... 040 ... 051 ... What is the fastest way to do this?? use sprintf $num = 1; $zero_num = sprintf("%03d", $num); #$zero_num will now have 001 perldoc -f sprintf -- To unsubscribe

Re: How to add leading zeros?

2005-02-16 Thread bright true
Hi , i hope this would help you out @array = (1,2,3,40,51); foreach $line (@array){ if($line > 9 ){ $add = "0";}else{ $add = "00";} print $add$line,"";} bye On Wed, 16 Feb 2005 13:28:11 +0100, Bastian Angerstein <[EMAIL PROTECTED]> wrote: > > Hello, > > I have some Numbers 1 2 3 40 51 and