# # if you know that there is no charge code 0 or # # empty string, you could compress that like so: # if ( my $code = $charge_codes{$src}{$dest} ) # { # ++$charges_against{$code}; # } # # if you need multiple codes per src/dest pair: # my $charge_code_aref = $charge_codes{$src}{$dest} # or next; # # increment the number of charges against each code # foreach my $code ( @$charge_code_aref ) # { # ++$charges_against{$code}; # }