在/ usr/bin中/ env的perl的
use warnings;
use strict;
my $text = 'hello ' x 30;
printf "%-20s : %s\n", 'very important text', $text;
這個腳本的輸出看起來更礦石較少像這樣:如何在Perl中創建列輸出?
very important text : hello hello hello hello
hello hello hello hello hello hello hello hello
hello hello hello hello hello hello hello hello
...
不過,我想這樣的輸出:
very important text: hello hello hello hello
hello hello hello hello
hello hello hello hello
...
我忘了提及:文本應該有一個開放的結尾,因爲文本行的右端應該對齊終端的大小。
我怎樣才能改變我的腳本來達到我的目標?
請解釋清楚 – muruga 2010-03-20 08:24:26
你說的是完全有道理的段落?這在終端上既困難又醜陋。我想你從未在CPM上使用過WordStar。 – 2010-03-20 13:05:22