http://www.perlmonks.org?node_id=2671

You need to use sprintf or printf.
$unrounded=0.66666; $rounded=sprintf("%.2f",$a) #$rounded is rounded to 2 decimal places + and is equal to 0.67 printf("$unrounded rounded to 3 decimal places is %.3f\n",$unrounded +);
You might also want to take a look at floor and ceil