in reply to Generating standard length strings

sprintf "%-${length}s", $string" Update: note that length here is the name of a variable, not the function call being interpreted as a reference.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: Generating standard length strings
by ihb (Deacon) on Apr 15, 2005 at 02:37 UTC

    sprintf '%-*s', $length, $string

    Less noise in the format.

    ihb

    See perltoc if you don't know which perldoc to read!