看板 Perl 關於我們 聯絡資訊
新手問題~ #check read file is ok unless (open(INFILE, "/var/log/123.txt")) { die ("cannot open file"); 請問一下如果開檔失敗,要如何把路徑檔名顯示在螢幕上讓user知道 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 192.156.198.62
godman362:把檔名當成參數紀錄,當錯誤的時候用參數顯示 10/24 12:32
godman362:這樣的方法覺得如何? 10/24 12:32
yanganto:open(INFILE, $file) || die "cannot open $file\a\n" 10/24 16:21
s1106:還可以這樣用啊~感恩~ 10/25 23:21