When I display this value within a table, it crops trailing zero's, so a value of $19.90 displays as $19.9
How can I control this?
NOTE: The section in question is in HTML format, using cgi variables. It is contained within a cgi "print block".
not sure how you are generating the dollar figures, but here's a generic example:
my @figures = (19.9, 100.000, 123.093, 34);
foreach my $line (@figures) {
$line = sprintf("%.2f", $line);
print "\$$line\n";
}
prints:
$19.90
$100.00
$123.09
$34.00
basically, just pass the variable you want to format to the sprinf() function. sprintf() has many common string formatting options:
[perldoc.perl.org...]