|
-
Jan 12th, 2004, 01:31 AM
#1
Thread Starter
Addicted Member
Calculating Prices In CGI/Perl
Hi,
I'm trying to calculate prices in CGI/Perl, but I'm having a problem with the loss of trailing zeros. ie.:
$Price1 = "1.20";
$Price2 = "1.50";
$TotalCost = $Price1 + $Price2;
'$TotalCost' would have the value of "2.7"... I want to be able to print it with a trailing zero on the end of it, so when I print it out it'll be "2.70" rather than "2.7", for example. How do I do this? I'm assuming this involves string/character checks and manipulation but I'm not sure how to go about it.
Cheers,
Git
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|