When I test print '$badword' it prints a list like
So I know the retrieved words are correct. I've done plenty of test prints to see what's going on throughout this process. I am thinking it has something to do with the s/// itself beacause it doesn't catch on- anywhere.'badword1' 'badword2' 'badword3' and so on
Can anyone possibly see why this swear filter isn't catching words?# @keep has all the messages in it. # @keep_after_swear_words should be the filtered version of @keep my $data = qq(SELECT id, word FROM swears); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr; my ($id, $badword); $sth->bind_columns(\$id, \$badword); foreach my $line (reverse @keep) { my ($username, $message, $date, $ip) = split(/<!!>/, $line); #print "user: $username<br> message: $message<br> date: $date +<br> ip: $ip<br><br>"; while ($sth->fetch) { $username =~ s/\b$badword\b/ **** /gi; $message =~ s/\b$badword\b/ **** /gi; } print "message: $message<br>"; push(@keep_after_swear_words, "$username<!!>$message<!!>$date<!! +>$ip"); } #.. print out modified text here
In reply to s/// not replacing data by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |