作者ezman (中庸之道,才是王道)
看板perl
標題[問題] 請問要如何把程式處理完的結果輸出到檔案呢?
時間Sat Apr 22 13:06:52 2006
請問一下
print"Hellow World \n";
假設我輸入上面的程式碼
她會在螢幕輸出 Hellow World
那可不可以讓它直接輸出到文字檔
而不是輸出到螢幕呢
謝謝大家.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.131.69.229
1F:推 iFEELing: > 04/22 13:38
2F:推 imce:perl a.pl >1.txt 04/22 14:38
3F:推 ezman:謝謝你,我知道了 04/24 14:24
4F:推 itemark:open(file, ">file") || die "$!"; 04/24 17:32
5F:→ itemark:print file "Hellow World \n"; 04/24 17:33
6F:→ itemark:close(file); 04/24 17:33
7F:→ itemark:第一行要補上執行perl的位置 我是用 #!/usr/bin/perl 04/24 17:33