### Here is a sample of the input file line: 563,U016228,4,CEL30.0-6/38,Kg,1217,0,1742,0,0,81.5,2070,Kg,trfJPL,81,1/2,01/15/02,118,30,tn,01/15/02,01/15/02 #### Code starts here ### foreach $line() { chomp($line); $line =~ s/"//g; $line =~ s/ //g; @record = split(/,/,$line); #### The custhash is created from an index file. if(!defined $custhash{$record[0]}[0]) { print "$line\n"; next; } $salesman = $custhash{$record[0]}[0]; $custnum = $record[0]; #### The next 2 lines are not producing the expected result! $hashlist{$salesman}{$custnum}[6] += $record[5]; $hashlist{$salesman}{$custnum}[6] -= $record[7]; ##### These 3 lines I used for debug and the results are ??? $orders += $record[5]; $shipments += $record[7]; $openorders += $hashlist{$salesman}{$custnum}[6]; #on hand inventory $hashlist{$salesman}{$custnum}[8] += $record[6]; @duedate = split(/\//,$record[16]); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime; if(($duedate[0] == ($mon+1)) && ($duedate[2] == ($year-100))) { #due this month $hashlist{$salesman}{$custnum}[7] += $record[9]; } } close (FILE); #### These lines are accurate data... $calcorders = $orders - $shipments; print "mk_sales1.pl orders=$orders shipments=$shipments\n"; print "mk_sales1.pl open=$openorders calc open=$calcorders\n"; exit; #### mk_sales1.pl orders=4555921.98401899 shipments=1018457.10569208 mk_sales1.pl open=162276886.110807 calc open=3537464.87832691