# catrep.pl open(W, "word.txt") || die "can't open words file."; print "==== Unmatched Records ====\n"; while () { chomp; @item = split(/\t/); $wordhash{$item[0]} = $item[1] if defined $item[1]; } while (<>) { chomp; @item = split(/\t/); $find = 0; foreach $key (keys %wordhash) { if ($item[1] =~ /$key/i) { $counter{$wordhash{$key}} += $item[2]; $find = 1; last; } } if ($find == 0) { print; print "\n"; } } print "\n==== Category Report ====\n"; while (($key, $value) = each %counter) { print "$key = $value\n"; }