Just insert the literal digit in the format and trim the size
accordingly.

sprintf("1%08d", $number);

Bob McConnell

-----Original Message-----
From: William [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 10, 2008 11:05 AM
To: beginner perl mailling list
Subject: format number with leading non-zero

Hello, I want to format a number to become a 9 digits representation,
every time it must have an integer 1 at the front.

E.g 
123 become 100000123
123456 become 100123456

If I use sprintf I can only make it to have leading zero such as
sprintf("%09d", $number);

Thanks.

William


Send instant messages to your online friends
http://uk.messenger.yahoo.com 

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



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


Reply via email to