Re: [問題] 讀取檔案的內容
my %total;
open (RESULT , "<". $result_file);
while(<RESULT>)
{
my ($check, $num, undef, $kind, undef, $qty) = split(/:\s|, /,$_);
$total{ $num } += $qty if $check =~ /Number/;
}
close (RESULT);
print "代號: $_, total: $total{ $_ }\n" for sort keys %total;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.16.166
※ 編輯: dryman 來自: 140.109.16.166 (11/14 09:53)
推
11/14 21:37, , 1F
11/14 21:37, 1F
→
11/14 21:38, , 2F
11/14 21:38, 2F
討論串 (同標題文章)
Perl 近期熱門文章
PTT數位生活區 即時熱門文章