Re: format number with leading non-zero

[email protected] (William)
Newsgroups perl.beginners
Message-ID <[email protected]>
> $ perl -le'
> for my $num ( 123, 123456 ) {
>      print 100000000 + $num;
>      }
> '
> 100000123
> 100123456
> 
> 
> 
> John
> -- 


Thank you, but I think this solution is more descent

> Just insert the literal digit in the format and trim the size
> accordingly.
> 
> sprintf("1%08d", $number);
> 
> Bob McConnell

Send instant messages to your online friends http://uk.messenger.yahoo.com
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.