$not_a_regexp = '\\d'; # The 2 chars: \d $not_a_regexp_quoted = quotemeta($not_a_regexp); # The 3 chars: \\d $not_a_regexp =~ /^$not_a_regexp_quoted\z/; # Matches.