Re: format number with leading non-zero
[email protected] ("John W. Krahn")
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
William wrote:
> Hello,
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
$ perl -le'
for my $num ( 123, 123456 ) {
print 100000000 + $num;
}
'
100000123
100123456
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall