my $sumcredits = 0; for (@trans_details) { $sumcredits += $_->{'credits'} }