You need to change:
for my $size (@sizeOfTrees) { my $quant = $tree_collection{$years}{$trees}{$size} || "-" +; printf "%9s", "$quant"; # { no warnings; $total += $quant; } # WHY DO I NEED TH +IS? }
To:
for my $size (@sizeOfTrees) { my $quant = $tree_collection{$years}{$trees}{$size} || 0; printf "%9s", $quant || '-'; $total += $quant; }
my $quantity = (); my $total_quantity = (); my $total = (); my $year_total = ();
Why are you trying to assign a list to a scalar variable? Don't do that, it makes no sense!
printf "%9s", "$quant"; printf "%5s", "$total"; printf "%9s", "$total_col{$i}"; printf "%5s", "$year_total";
Don't quote scalar variables. Perl is not a shell! What's wrong with always quoting "$vars"?
In reply to Re: Creating Reports with hashes: Use of uninitialized value while adding integers
by jwkrahn
in thread Creating Reports with hashes: Use of uninitialized value while adding integers
by GertMT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |