Depending on the needs, this method is a bit too strict, as it will reject even compound words that contain a offensive word as a subword.
A way that could also be worked around, but which would create less false positives, would be to make sure each offensive word is used as a word alone :
my $badwordsRE = "\\b" . join( "\\b|\\b", @badwords ) . "\\b";
reject if /$badwordsRE/o;
My advice to the original poster is to get a list of offensive words from the web master administrator or some other person responsible for that thing and use that list as a ban list - so he is clean with them. If there is no such list, then I wouldn't censor at all.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
|