我有一个很大的段落,我需要分成几行,这样每行不得超过100个字符,不得破坏任何单词.我该怎么做呢?我想正则表达式是最好的方法,但我不知道如何.
使用
Text::Wrap.
Text::Wrap::wrap()
is a very simple paragraph formatter. It formats a single paragraph at a time by breaking lines at word boundaries. Indentation is controlled for the first line ($initial_tab
) and all subsequent lines ($subsequent_tab
) independently.