看板 Perl 關於我們 聯絡資訊
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)
hws110:感謝您~不過我將split(/:\s|,改成split(/\s|,才可正常輸出 11/14 21:37
hws110:就有抓到我要的值了~ 11/14 21:38