For a fixed width $width, you want to wrap your text at that width, more precisely at a blank space just before that width. This can be achieved by a regex like this s/(.{1,$width}\s/$1\n/g.
You then want to pad the last line with blanks to that specified width and then print done.. The padding can be achieved by using the following expression: $1.(' 'x($width-length($1)))."\n" instead of the one above. This would pad each line with blanks but that should not be a problem. In order to make it work, you have to specify /e in your substitution operator.
In reply to Re: Console Output Formatting Help Required
by hdb
in thread Console Output Formatting Help Required
by tarunmudgal4u
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |