in reply to Dynamical formating with sprintf?

sprintf '%*s', length $x, $x

Also, consider using Text::Table. It's worth it.

-Paul