$input = "There's the b/a/d/w/o/r/d."; (my $test = $input) =~ s/\W+//g; if($test =~ /badword/) { print "You sneaky devil!\n"; }