What do you mean, exactly, by the "first answer"? Both
vroom's and my answer's define a pad subroutine that
you can give a string and a length that you want the
padded string to be. They accomplish the end result in
different ways, but both work, and neither assume that
you must know the string length beforehand.
Blech. For some bizarre reason, I was thinking vroom's
pad was having the length of the initial string passed to
it, not the length of the output string. Whip me and call
me an idiot.