I would probably build a new line delimited text file of words I deemed as "bad". I would then have the Perl script do the following:
1) Open & Read badwordFile
2) Build the bad words into a data structure (most likely an array)
3) itterate through the bad words. For each bad word, perform a regular expression match against the user-submitted guestBook entry, and replace it with "****".
Ex:
Code:
$string =~ s/badword/******/gi;
Something along those lines would be fairly easy to program and should work out fairly well for you.