Chris,
printf credit %s, amount %12.12d\n, $credit, $amount;
What really went wrong was to use a %d specifier. It says to truncate
a floating number into integer. Like it happens in
$ perl -e 'print int 1000*shift' 64.63
64629
If you use %f, it may improve
$ perl -e 'printf %f,
Howard, Chris schreef:
What starts out as 64.63 ends up being 0006462
No, it ends up beint printed as that. Replace your %12.12d by one of
(%s, %f, %g) to get different representations.
See also
perldoc -q decimals
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe,
But the file output format I'm required to produce
is 12 positions with leading zeros and no decimal.
:-(
Chris
-Original Message-
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: Monday, August 28, 2006 11:17 AM
To: beginners@perl.org
Subject: Re: number rounding problem
Howard
; beginners@perl.org
Subject: RE: number rounding problem
But the file output format I'm required to produce is 12 positions with
leading zeros and no decimal.
:-(
Chris
-Original Message-
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: Monday, August 28, 2006 11:17 AM
To: beginners@perl.org
Howard, Chris schreef:
[next time, do not toppost, and quote more effectively]
Ruud:
Chris:
What starts out as 64.63 ends up being 0006462
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
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