$str =~ s{\\Q(.*?)\\E){quotemeta $1}ge; [download]
In reply to Re^2: Unrecognized escape \Q passed through in regex by Anonymous Monk in thread Unrecognized escape \Q passed through in regex by Articuno