my $target = "[a]"; if ($string =~ m/\Q$target\E/) { ... } # or: my $re = quotemeta($target); if ($string =~ m/$re/) { ... }