pgmer6809 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to write a report and have the decimal points in the various numbers line up properly. But using say %4.2f or % 4.2f or %04.2f all have the same problem when the value in question is zero. Is there a format spec that will fix this?

 perl -e'$fmt="\n%3d : %04.2f : %3d";printf $fmt,3,12.34,-1;printf $fmt,2,00.00,1;print "\n";'


3 : 12.34 : -1 2 : 0.00 : 1