in reply to Problem subtracting in Perl
I'm guessing your data file has multiple lines with the same $salesman and $custnum. When you hit the second one, the "$openorders +=" line double-counts the open orders from the first. It's probably better to calculate the open orders after you've loaded all the records, instead of trying to update it as you go along.
As a stylistic note, this is hard to understand:
$hashlist{$salesman}{$custnum}[6]
And it would probably be better written like this:
$hashlist{$salesman}{$custnum}{open_orders}
Or this:
use constant OPEN_ORDERS => 6; # at top of code $hashlist{$salesman}{$custnum}[OPEN_ORDERS]
|
|---|