use List::Util qw/sum/; $header{"Number of Drills"} = sum map $_->count, map { values %{ $_->tool } } @drill_arr;