I have a perl project that take a csv file and then process it. It will take the records and put them in different files depending on the results of the processing, such as, if the record is to many pages it will place the record in a bad record file and if the record is printed by an exempted staff member it will place the record in the staff file. There is a separate file that holds the exempted staff members
The problem I have is when I try to compare the record to the exempted staff file. Here is how I do it so far:
Code:
open(IN, "etc/except.txt");
(IN) || die "Unable to open exceptions!\n";
while(<IN>) {
chop;
tr/A-Z/a-z/;
push(@except, $_);
}
close(IN);
I then open the other files for the process and here is the section that does not work correctly:
Code:
while(<IN>) {
$count = @except;
for ($i=0; $i<$count; $i++) {
if ($a[5] = $except[$i]) {
print STAFF "$_\n";
next;
}
}
}
obviously there are other statements that process the rest of the records, but they work just fine. For some reason this ends up placing all record into the staff file. How do I get this fixed?