in reply to A Procrustean Statement

The following will pad but not truncate:
$_ = sprintf '%-*s', $len, $_;

Replies are listed 'Best First'.
Re^2: A Procrustean Statement
by YuckFoo (Abbot) on Jun 16, 2006 at 17:21 UTC
    Pad and truncate:
    $_ = sprintf '%-*.*s', $len, $len, $_;