http://www.perlmonks.org?node_id=1170912


in reply to Re: Using (s)printf()
in thread Using (s)printf()

Try this

perl -E 'printf("%12.4f\n",12.34)'

gives

>     12.3400

see the docs for sprintf for much more detail :) but in brief it's "%<length>.<dp>f"