#指定の文字幅で段落を整形する $length = 50; $/ = ""; while (<>) { s/ *\n */ /g; s/ +$//; s/(.{0,$length}) +/$+\n/g; print "$_\n"; } exit;