in reply to Array Trouble!

Well for one, correct your syntax. The fifth line should be something like
$comment =~ s/$l/****/g;
= isn't the right operator for substitution.

Here is some working code that you should be able to modify.

my $foo = "man, that's some badass motherfucking shit!"; my @badwords = qw/ass fuck shit/; foreach my $word (@badwords) { my $bleep = "*" x length($word); $foo =~ s/$word/$bleep/g; } print $foo, "\n";
which outputs
man, that's some bad*** mother****ing ****!

Updated Formatting

Update 2 In your database, the words are one per line it seems. Therefore, the words all have a \n on the end of them, so unless the "bad" word in the comment has a newline after it, it won't match. Make the syntax correction I noted above, and add chomp($l); as the first statement in your loop, and it should work. The chomp removes the last character of a string if it is a newline.

Replies are listed 'Best First'.
Re: Re: Array Trouble!
by ACJavascript (Acolyte) on Apr 10, 2003 at 01:28 UTC
    Yea the = was a miss print on my part,,,
    Hey both of yours worked GREAT!
    THANK YOU BOTH SO VERY MUCH!!