$string_to_check="yyy foo-bar doo zzz"; if ($string_to_check =~ /\b$check\b/) { ... }