#!/usr/bin/perl # hmm, try bleeping... use strict; my @badwords = qw(crud poop darn); my $cleanbook; # i wonder if it will work... my $match = join("|",@badwords); # lazy, not checking badwords. while () { # ahh, inefficiency! while ($_ =~ /$match/i) { my $bad = $&; (my $bloop = $bad) =~ s/(?<=\w)\w/\*/sg; $_ =~ s/$bad/$bloop/sg; } $cleanbook .= $_; } print $cleanbook; __DATA__ "Crud," said Travis. But then, Travis was always something of a poopy-head. He could never keep to his darned self. Darn it Travis!