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


in reply to Rounding to a Given Number of Significant Figures Rather Than Decimal Places

use the printf format. Where "%.2f" effectively means print to 2 decimal places - and perl rounds things nicely for you
my $number = 0.9999; printf "number = %.2f \n", $number;
Or if you just want to store it and then use it later uses sprintf
my $number = 0.9999; $rounded = sprintf "%.2f", $number; print "rounded = $number\n";

A.A.

Update:

A.A. is having a bad day and begs your indulgence for his stupidity