wrap一次掃瞄一個段落,將它們以字為單位輸出。如果一個字超過輸出的寬度,wrap會根據輸出的寬度斷字,再將剩下的字母接到下一行。
use Text::Wrap qw(wrap $columns);
$columns=72;
die "usage: $0 file" unless @ARGV;
my $file=shift;
open(F, $file)or die "open: $!";
my @lines=;
close(F) or die "close: $!";
print wrap("\t", "", @lines);

$columns變數設定輸出寬度。輸出時以Tab去作第一行的縮排。
arrow
arrow
    全站熱搜

    jck11 發表在 痞客邦 留言(0) 人氣()