# public getBalansCreditAmount to get the amount of all accounts sub getBalansCreditAmount { my $closure = shift; my $totalCreditAmount = $closure->getCreditAmount(); for my $balans ( $closure->getCreditAccounts() ) { $totalCreditAmount += $balans->getBalansCreditAmount(); } return $totalCreditAmount; }