看板 Perl 關於我們 聯絡資訊
※ 引述《polla ( 過客)》之銘言: : 大家好!! 我是一個新手 : 目前利用perl來處理資料 有個問題請教各位大大 : 不知道perl有沒有同時開啟檔案 依序讀取檔案的資料的功能 : 譬如說 open file1 file2 file3 : 將3個檔案的紀錄 依序讀入一個array 把file1 file2 file3內容讀進陣列: map {open F,$_; push @rec,<F>;} qw(file1 file2 file3); : 再將所以資料進行加總 或平均 加總: chomp and $sum+=$_ foreach (@rec); 平均: $avg=$sum/int(@rec); : 最後輸出到單一檔案 : 請各位大大幫我解決這個疑惑???? 輸出檔案我應該不用說了吧 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.244.211