sub sum_hash { my $href = shift; my $total = 0; for ( @_ ? @{$href}{@_} : values %$href ) { $total += $_; } return $total; }