(defined $hash{$array[0]}{$id}) ? ($hash{$array[0]}{$id} += $array[2]) : ($hash{$array[0]}{$id} = $array[2]);
That's more complicated than is necessary. Perl's clever enough to know that if you add a number to an undefined variable, to treat that var as 0. This would suffice:
$hash{$array[0]}{$id} += $array[2];
In reply to Re^2: Summing column values
by BrowserUk
in thread Summing column values
by lokesha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |