I want to show the dollar value with two digits after the decimal point to indicate cents. In the program below, the output is 23.24. Perl rounds decimals. How to avoid this. I want the result to be 23.23.
$val=23.2395;
$testa=sprintf("%.2f", $val);
print "\n$testa\n $val";
source
share