my $new_value = sprintf("%.5f", $unformatted_value); s/old_value/$new_value/;