my %h; ...; # get info from db $h{$total} += $revenue;