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