my %data; while (@array) { my ($name, $time) = splice @array => 0, 2; $data {$name} += $time; }