in reply to Re^4: s/// not replacing data
in thread s/// not replacing data

Now try:
while ($sth->fetch) { $username =~ s/\b\Q$badword\b/ **** /gi or print "[$badword] not found in $username\n"; $message =~ s/\b\Q$badword\b/ **** /gi or print "[$badword] not found in $message\n"; }
The \Q is mostly precautionary, in case $badword might have a regex-special char in it.

Caution: Contents may have been coded under pressure.