Complete.Org: Mailing Lists: Archives: discussion: October 2000:
[aclug-L] Formatting numbers in Perl!
Home

[aclug-L] Formatting numbers in Perl!

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: discussion@xxxxxxxxx
Subject: [aclug-L] Formatting numbers in Perl!
From: Mohammad Islam <sohel@xxxxxxxxxxxxx>
Date: Fri, 20 Oct 2000 00:14:21 -0500
Reply-to: discussion@xxxxxxxxx

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


[Prev in Thread] Current Thread [Next in Thread]