in reply to auto-escaping??

Consider eval for use with your 2nd print, and using non-interpolatnig quotes "'" with concatenation "." for your 3rd assignment so your first print is as you expect.

Of course there are issues with this, depending on where you're getting the values for $var1 and $var2, they could contain potentially nasty commands that would be run in the eval. See perlsec.

--
perl -p -e "s/(?:\w);([st])/'\$1/mg"