Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[HELP] Spam checking [PERL]

Name: Anonymous 2009-03-08 5:38

I'M NOT GOOD WITH COMPUTERS

sub spamcheck() {
open(SPAM, "<spam.txt") || die 'MISSING';
@raw_data=<SPAM>;
close(SPAM);
for(@raw_data) {
  /^(.*)$/;
  my $blocked = $1;
  die 'SPAM' if $comment =~ $blocked;
 }
}


I'm trying to make some sort of spamchecker so when a person submits a comment, it is checked against spam.txt and if it doesn't match any of the lines, then it is allowed to continute.

However this bit of code isn't working for me. For example, I have spam.txt with several lines of test words, the first line is derp and when I submit a comment with the word derp it doesn't stop the comment from being submitted. However, when I submit a comment with derp and then a newline, it errors as it's supposed to. But it only does with with the first line. The other lines in spam.txt don't trigger it at all.

Please help me.

Name: Anonymous 2009-03-08 10:42

OP here, I changed my mind:

Don't help me.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List