in reply to Eliminating Trailing Zeros


Use the g format instead of f and no further formatting should be required:
$ perl -e 'printf "%2.4g\n", 23.05' 23.05 $ perl -e 'printf "%2.4g\n", 23.00' 23
See the sprintf manpage for more details:
g The double argument is converted in style f or e (or E for G conversions). ... Trailing zeros are removed from the fractional part of the result; ...

--
John.