In a regular expression, all chars between the \Q and \E are escaped. See quotemeta in perlfunc.
In your code sample, you are appending a string, that looks like a regular expression, onto the end of $code.
I couldn't find my Perl Cookbook, must have left it at work, however, the code you are referring to is probably assembling a regex so it then can eval it. I seem to remember it was showing some way of performing efficient variable regex's.