in reply to Dynamical formating with sprintf?

Yes. Use * inplace of the number in the format string and use a variable before the item to be output. An example is probably clearer:

[0] Perl> printf "[%*s]\n", $_, 'fred' for 4 .. 10;; [fred] [ fred] [ fred] [ fred] [ fred] [ fred] [ fred] ## Added: left justified [0] Perl> printf "[%-*s]\n", $_, 'fred' for 4 .. 10;; [fred] [fred ] [fred ] [fred ] [fred ] [fred ] [fred ]

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."