in reply to Match first word in line fails

IŽd rewrite your code as follows:
#!/usr/bin/perl use strict; use warnings; my $badwords = join("|", @badwords); while (<$book>) { s/[\"'.,!?:;()[\]{}|\\\/-]/ /g; #replace all punctuation with a sp +ace s/\b($badwords)\b/replaceword($1)/eig; #replace all bad words, ign +ore case }
Update:
It will be much easier for us to tell, if you give us more sample data.

holli, regexed monk

Replies are listed 'Best First'.
Re^2: Match first word in line fails
by lidden (Curate) on Jan 30, 2005 at 05:10 UTC
    Yes, but he did not want to remove punctuation from the results. So I guess the first line in the loop shoud be dropped too.
Re^2: Match first word in line fails
by yacoubean (Scribe) on Jan 30, 2005 at 05:29 UTC
    I guess that's better, it finds more words than before, but it still isn't finding all of the words. But alas, I'm too tired to work on it more at this hour. I'll hit it more tomorrow and let you guys know.
    --------------
    My home on the web: http://www.techfeed.net/