In PG, when you have a backslash in your code it will be translated into a double backslash before perl does any interpolation. Your:
and then perl is looking for a
not looking for a digit.
It appears that the translator is not doing this when the backslash is inside single quotes.
The reason this happens has to do with backslash also being the LaTeX escape character. So in a math expression, you don't want perl to turn your \frac into whatever \f is followed by rac. The translator makes it \\frac, before perl processes it back to \frac.
And if you really need a backslash, PG lets you use ~~. So your example can be:
And the translator stage will turn the ~~ into a single backslash before perl processes things further.