# rounds to 0.01 (assumes positive number): my $cleanFloat = sprintf "%.2f", $dirtyFloat + 0.004; # truncates to 0.01: my $cleanFloat = sprintf "%.2f", $dirtyFloat;