while(<>) {
s/[\r\n]//g;
printf("%d,%s\n", $., $_ );
}
exit;
田中 佐藤 鈴木
とタイプします。c:\perl> perl n.pl dat1.txt
と出力されるはずです。1,田中 2,佐藤 3,鈴木
printf("%d,%s\n", $., $_ );
を
printf("%d:%s\n", $., $_ );
に変更すればよいのです。
printf("%d,%s\n", $., $_ );
を
printf("%d,%s\n", $. + 100, $_ );
とすればよいのです。
Copyright © 2004 TKEN