Thanks!


-----Original Message-----
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: Monday, August 28, 2006 12:00 PM
To: beginners@perl.org
Subject: Re: number rounding problem


Howard, Chris schreef:

[next time, do not toppost, and quote more effectively]

> Ruud:
>> Chris:

>>> What starts out as 64.63  ends up being 00000006462
>>
>> No, it ends up beint printed as that. Replace your %12.12d by one of
>> (%s, %f, %g) to get different representations.
>
> But the file output format I'm required to produce
> is 12 positions with leading zeros and no decimal.

Then make sure that the numerical value of the variable is what you want
it to be, for example:

  $amount = int(0.5 + $amount / 10) ;

Alternative format: %012d.

-- 
Affijn, Ruud

"Gewoon is een tijger."



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to