RE: format number with leading non-zero

[email protected] ("Bob McConnell")
Newsgroups perl.beginners
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.