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


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

Trailing whitespace can be a bit tricky. Maybe something like:

c:\@Work\Perl\monks>perl -wMstrict -le "for my $n (qw( 0.12345 -0.12345 123456.12 -123456.12 123456.12345 -123456.12345 )) { my ($left, $right) = (7, 5); my $s = sprintf qq{%${left}s.%-${right}s}, split m{[.]}xms, $n, 2; print qq{'$s'}; } " ' 0.12345' ' -0.12345' ' 123456.12 ' '-123456.12 ' ' 123456.12345' '-123456.12345'


Give a man a fish:  <%-{-{-{-<