William wrote:
>
> John W. Krahn wrote:
>>
>> $ perl -le'
>> for my $num ( 123, 123456 ) {
>> print 1 + $num;
>> }
>> '
>> 10123
>> 100123456
>
>
> Thank you, but I think this solution is more descent
>
> Bob McConnell wrote:
>>
>> Just insert the literal digit in the format
> $ perl -le'
> for my $num ( 123, 123456 ) {
> print 1 + $num;
> }
> '
> 10123
> 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", $numbe
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 10123
123456 become 100123456
$ perl -le'
for my $num ( 123, 123456 ) {
print 1 + $num;
}
'
10123
1001234
Thank you very much, I don't if the solution is so simple. Hehe
- Original Message
> From: Bob McConnell <[EMAIL PROTECTED]>
> To: beginner perl mailling list
> Sent: Tuesday, June 10, 2008 23:40:29
> Subject: RE: format number with leading non-zero
>
>
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-ze