chomp for @blocked; # don't expect to match newlines
if ( grep { $FORM{'comments'} =~ /\b$_\b/ } @blocked) {
...
}
This is somewhat simplistic, not to mention inefficient - the grep continues over every word in the list even if the first word matches. A better approach would use a for loop:
chomp for @blocked;
for my $m (@blocked) {
if ($FORM{'comments'} =~ /\b$m\b/) {
# print your message here.
exit; # could also last outside the loop
}
}
The \b markers are to match at a word boundary, so BLOCK will not be matched in THIS SHOULD BE UNBLOCKED, for example.
However you may want to re-think your approach. Simplistic blockers like this rarely achieve the desired results, and often produce too high a level of false positives to be truly useful. YMMV, of course.