i think
a. the first one compiles, the second does not.
b. in the first one, perl can see balanced brackets {},
but in the second one, perl probably gets confused about
$class{'name}'} which parses fine if not in qq{}.
just a guess. and now i'll try it out =)