Perlコーディング初心者質問スレ Part 55
■ このスレッドは過去ログ倉庫に格納されています
0809nobodyさん
2007/08/24(金) 19:20:09ID:???use strict;
my @COST = (
['2000','3','6000'],
['3000','4','12000'],
['1000','5','5000'],
['4000','3','12000'],
);
use Data::Dumper;
my ($avarage_cost, $total_pieces, $total_price);
for my $param (@COST) {
my ($unit_cost, $pieces, $price) = @$param;
$total_pieces += $pieces;
$total_price += $price;
$avarage_cost = $total_price / $total_pieces;
print "$avarage_cost\n";
}
■ このスレッドは過去ログ倉庫に格納されています