in reply to array of MySQL data for substitution

I don't know why you are getting no substitutions, but if I were doing this, instead of storing words in the DB, I'd store regexp strings (e.g. '\bfudge(?:d up)?\b') that I would then convert to regexps using qr; e.g.:

while(my $ref = $sth->fetchrow_arrayref) { push @sw_regexps, qr($ref->[0]); }

Also, you probably want the /g modifier in that s///

the lowliest monk