use Text::Wrap; $Text::Wrap::columns = 20; #$text=~tr/\n/ /; print wrap('', '', $text);