making a simple send email script using a simple form and sendmail.
Now, I want to check the text which is being sent for "bad" words. Say I got a file, including the words with separated with a |. I want to check if this text includes one, or more of these words.
How should I do it?
All the words are on the same line. Should I then use
foreach $line (@file) {
chomp($line);
}
Or? And I must use a regexp to find the words, right?
if ($message =~ /$line/i) {
print "We don't like the words you used in the mail. Therefore we didn't send it! Ha!";
}
}
Something like this? I really stink at using regexps.
Someone got a clue how this should be done?
Thanks.
- perlman
Now, I want to check the text which is being sent for "bad" words. Say I got a file, including the words with separated with a |. I want to check if this text includes one, or more of these words.
How should I do it?
All the words are on the same line. Should I then use
Code:
foreach $line (@file) {
chomp($line);
}
Or? And I must use a regexp to find the words, right?
Code:
foreach $line (@file) { if ($message =~ /$line/i) {
print "We don't like the words you used in the mail. Therefore we didn't send it! Ha!";
}
}
Something like this? I really stink at using regexps.
Someone got a clue how this should be done?
Thanks.
- perlman