in reply to (golf)String Concats or: playing with substr()
I wanted a solution that used one regex, so here it is:
$text =~s/(.{1,$length}).*/ length($1)<$length?$"x($length-length($1)).$1:$1/e; [download]