[aclug-L] Formatting numbers in Perl!
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
I was wondering someone can provide some pointers regarding formatting
numbers in perl.
Lets say I have the following variables:
$price = $49.50;
$quantity = 2;
$sub_total = $price * $quantity
print $subtotal show 99.
Now I want $sub_total to be $99.00 [up to two decimal places].
How can go about accomplishing it? I have looked into printf from the
"Learning Perl" book, but i do not intend to print to the screen. I want
to store the formatted value to another variable for later use.
Any help would be gratly appreciated.
Thanks.
Moe
-- This is the discussion@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
- [aclug-L] Formatting numbers in Perl!,
Mohammad Islam <=
- [aclug-L] Re: Formatting numbers in Perl!, Steven Saner, 2000/10/20
- [aclug-L] Re: Formatting numbers in Perl!, Mohammad Islam, 2000/10/20
- [aclug-L] Re: Formatting numbers in Perl!, Jesse Kaufman, 2000/10/20
- [aclug-L] Re: Formatting numbers in Perl!, Jeremy King, 2000/10/20
- [aclug-L] Re: Formatting numbers in Perl!, Jeff Schaller, 2000/10/20
- [aclug-L] Re: Formatting numbers in Perl!, Steven Saner, 2000/10/20
- [aclug-L] Re: Formatting numbers in Perl!, Jeff Schaller, 2000/10/20
|
|