Hi All,
I am struggling to create a report that will parse a bunch of files 1 at time and report back the number transactions per unique bank code. Bank code is the first field in the separated my \t in each file. Here is the code I have which is not counting correctly.
=====
open (logfile, ">>$LogName");
while ($line = <cfile>) {
$counter++;
$BankCode=(split(/\t/,$line))[0];
print "$BankCode\n";
push(@bc ,"$BankCode");
}
my %count;
map { $count{$_}++ } @bc;
$count = return %count;
map {print logfile map {print logfile "$ClientCode[$clientindex][0]\
+t$_\t$FileType[$fileindex][1]\t$CurrFile\t${count{$_}}\t$CurrZipFile\
+t$yyyymm\t$onDemand\n"} sort keys(%count);
=====
$_ = the BankCode in the print line
Any suggestions? It appears to add the count from the last unique bankcode from the last file to the new files bankcode count.
Thanks in advance