in reply to Am I developing poor style?

You could use the sum function from List::Util:
use List::Util qw/sum/; $header{"Number of Drills"} = sum map $_->count, map { values %{ $_->tool } } @drill_arr;
I haven't benchmarked this so don't know how it compares to yours. I'd guess it'd be faster since yours has to build up a code ref then get rid of it, etc. And sum is implemented in C, so it's fast.

Update: okay, benchmarked them:

timethese(-6, { 'sum' => sub { my $n = sum map $_->{count}, map { values %{ $_->{tool} } } @drill_arr; }, 'sub' => sub { my $n = &{ sub { my $ret; foreach my $l ( @drill_arr ) { foreach ( values %{$l->{tool}} ) { $ret += $_->{count}; } } return $ret; } }; }, });
Results:
Benchmark: running sub, sum, each for at least 6 CPU seconds... sub: 7 wallclock secs ( 6.00 usr + 0.00 sys = 6.00 CPU) @ 15 +883.17/s (n=95299) sum: 6 wallclock secs ( 6.02 usr + 0.00 sys = 6.02 CPU) @ 40 +993.85/s (n=246783)
So using sum is lots faster, apparently.

Note however that I'm not using method calls; I just set up a dummy array holding hashes of hashes that I'm using.

Replies are listed 'Best First'.
(tye)Re3: Am I developing poor style?
by tye (Sage) on Jan 17, 2001 at 00:56 UTC

    Ah, to have list-context dereference semantics...

    $header{"Number of Drills"}= sum ( values @drill_arr==>tool==>% )==>count;
    yummy.

            - tye (but my friends call me "Tye")