Unitialied error
===

Key is another file I'm using. I want to search .txt which are firms filings and print the information to one csv file. I tried to use the module but was not successful am trying to have my files seperate.

    my $file;
    my $m;
    my $tax = 0;
    my $company = "";
    foreach $file (@files){
    open(FILE, $file);

     my @fileText = <FILE>;
     my $fullText = join('',@fileText);
        $fullText =~ s/<.*?>//gs;
        $fullText =~ s/&nbsp;/ /g;
        $fullText =~ s/&#...;//g;

     my @fileText = <FILE>;
        $fullText =~ /FILED AS OF DATE:\s*(.*)\n/;
        my $fileDate = $1;
        $fileDate =~ s/[\r]//g;

        $fullText =~ /COMPANY CONFORMED NAME:\s*(.*)\n/;
        my $companyName = $1;
        $companyName =~ s/[\r]//g;

        $fullText =~ /FORM TYPE:\s*(.*)\n/;
        my $formType = $1;
        $formType =~ s/[\r]//g;

        $fullText =~ /CENTRAL INDEX KEY:\s*([0-9]{10})/;
        my $taxID = $1;
        $taxID =~ s/[\r]//g;
        $taxID =~ s/^0*//;

        if ($tax != $taxID && $taxID != 0) {
           $tax = $taxID;
           $company = "\L$companyName";
           $company =~ s/\b(\w+)\b/ucfirst($1)/ge;
           $company =~ s/[^a-zA-Z0-9& ]//g;
           $m = $hash{$taxID};
           $m  =~ s/[\r]//g;

           open(KEY,"$key");
           print KEY "$m\t$taxID\t$company\n";
           $company =~ s/ /_/g;
             }