Another way to do the actual rounding is to use Math::Round. The nearest() function can round to a whatever acuracy you want. This does the same as the sprintf() version, except that the results are numbers, so you don't get trailing '0' characters in the output: