open(IN, "input.txt");ファイルを開く (Write)
open(OUT, "> output.txt");追記 (append)
open(OUT, ">> output.txt");ファイルオープンに失敗した場合は終了する
open(IN, "input.txt") || die("Cannot open file\n");
1 行ずつ読み込む
while ($xx =ファイルに書き出す) { print($xx); }
print(OUT $xx);ファイルハンドラを閉じる
close(IN);ファイルオープン失敗
$success = open(LOG, "logfile");
if (!$success) {
# The open failed
die("Cannot create logfile: $!");
}
print("Close file\n");
close(LOG);
0 件のコメント:
コメントを投稿