Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: s/// not replacing data
by Roy Johnson (Monsignor) on Oct 31, 2005 at 16:21 UTC | |
by Anonymous Monk on Oct 31, 2005 at 16:28 UTC | |
by VSarkiss (Monsignor) on Oct 31, 2005 at 16:38 UTC | |
by sulfericacid (Deacon) on Oct 31, 2005 at 16:43 UTC | |
by VSarkiss (Monsignor) on Oct 31, 2005 at 16:51 UTC | |
| |
by davido (Cardinal) on Oct 31, 2005 at 16:34 UTC | |
by japhy (Canon) on Oct 31, 2005 at 16:39 UTC | |
by davido (Cardinal) on Oct 31, 2005 at 16:41 UTC | |
by VSarkiss (Monsignor) on Oct 31, 2005 at 16:42 UTC | |
by davido (Cardinal) on Oct 31, 2005 at 16:46 UTC | |
by Anonymous Monk on Oct 31, 2005 at 16:41 UTC | |
by Roy Johnson (Monsignor) on Oct 31, 2005 at 17:05 UTC | |
by Anonymous Monk on Oct 31, 2005 at 17:10 UTC | |
by Roy Johnson (Monsignor) on Oct 31, 2005 at 17:30 UTC | |
|
Re: s/// not replacing data
by stonecolddevin (Parson) on Oct 31, 2005 at 21:41 UTC |