string formatting - How can I round and print a floating point number in a minimum width format in Perl -
i wanted like:
printf('%3.3f%% ', $percent);
but i'm still getting output as:
99.999% 100.000%
i like:
99.999% 100.000%
so pads less full width spaces. format specifier accomplish i'm trying do?
the number before dot represents minimum value full field width, need 7 in there allow 3 digits before , after decimal point, , 1 more point itself:
printf "%7.3f%%\n", $_ 99.999, 100;
output
99.999% 100.000%