# after some playing around, I came up with the # following regex that does wrapping at column # 60 perfectly. I love perl. ;-) $text =~ s/(.{50,60}(?<=\s\b))/$1\n/mg; print "$text\n";