in reply to Formating a printf statement using a variable

The "old fashioned" way of doing this, without string interpolation, is like so:      printf ("%-*s", 2, $var1); Where the asterisk indicates that the width of the field is supplied as an argument, which in this case is 2 but could easily be a variable or result of a calculation.

Update: Albannach was kind enough to point out that this feature of the Perl printf was added in version 5.004. Historically, C compilers have supported this method since the beginning of time, since there is no built in "string interpolation" method.