- or download this
if (defined $total {$id}) {
$total {$id} += $amt;
...
else {
$total {tocredit} += $amt;
}
- or download this
$total {exists $total {$id} ? $id : "tocredit"} += $amt;
- or download this
(exists $total {$id} ? $total {$id} : $total {tocredit}) += $amt;