sub filter { my $data = shift; open(FH, "filter") or die $!; my @words = ; foreach my $word (@words) { #chomp $word; $word =~ s/\r//; $word =~ s/\n//; error('bad word found') if ($data =~ /$word/i); } return $data; }