- my $total = sum @order;
- printf '%s total', color(1) . $opt{'value-format'}->($total) . color(0);
- printf ' in %d values', scalar @order;
- printf ' over %d lines', scalar @lines if @order != @lines;
- printf(' (%s min, %s avg, %s max)',
- color(31) . ($opt{reformat} ? $opt{'value-format'} : sub {$_[0]})->($order[-1]) . color(0),
- color(36) . ($opt{reformat} ? $opt{'value-format'} : $opt{'calc-format'})->($total / @order) . color(0),
- color(32) . ($opt{reformat} ? $opt{'value-format'} : sub {$_[0]})->($order[0]) . color(0),
+ $vars{partsum} = sum(0, grep {length} @values[$linemin .. $linemax])
+ if $linemin <= $linemax and ($opt{hidemin} or $opt{hidemax});
+ %vars = (%vars,
+ sum => sum(@order),
+ min => $order[-1],
+ max => $order[0],