格式文本我對這個模板的文本:用Perl
In 1935 he was asked to document the principal dancers and productions and
George newly .
he continued to shoot fashion
Bergdorf Goodman and Saks Fifth
started a series of photographs .
,並希望每一個段落轉換爲由seprated一線「\ n」,即輸出將是:
In 1935 he was asked to document the principal dancers and productions George newly .
he continued to shoot fashion Bergdorf Goodman and Saks Fifth started a series of photographs .
如何用perl格式化這樣的東西?有人可以提供一個例子嗎?
我試圖用文字::裹像下面卻得到不想要的結果
$Text::Wrap::separator=' ';
my $text=fill("","",$text);
要使用'文本實現這一:: Wrap'你必須先單獨段落('拆分 「\ n \ n」,$ text'),然後換行每個數組元素。 – dgw 2012-01-31 15:38:12
你的用途是什麼?只是改變一個文本文件?修復腳本中的字符串/文件句柄? – TLP 2012-01-31 16:50:34
http://p3rl.org/Text::Autoformat – daxim 2012-01-31 17:55:02