On Thu, 21 Oct 2004, A Taylor wrote:
> Date: Thu, 21 Oct 2004 14:34:21 +0100
> From: A Taylor <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
Do not do that. Please. One copy is plenty.
> I am trying to figure out sprint and prinf: what I am trying to do is
> format a number into a currency, so 9.9 would be printed as 9.90
>
> Can anyone give me a simple example of this - i am not having any joy
> by myself :s
Please learn how to use perldoc, Google, &/or books.
The first hit on a Google search for "perldoc sprintf" gives this:
# Round number to 3 digits after decimal point
$rounded = sprintf("%.3f", $number);
<http://www.perldoc.com/perl5.8.4/pod/func/sprintf.html>
Hopefully you can figure out how to adapt this for 2 digits.
--
Chris Devers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>