To add to what
blakem said, \Q is the "begin" and \E is the "end". He left off the \E because the $var was the last thing in your pattern. But in the general case, you'll use both. e.g.
m/prefix\Q$var\Esuffix/. Do that anytime you have a $var in a pattern that you want taken literally, as opposed to containing more regex instructions.
$s="a*";
/$s/; # same as /a*/, finds a string of a's
/\Q$s\E/; # same as /a\*/, literally matches "a*" characters.