in reply to unescape a user-entered string?

Hmm, maybe it is easier to invert it - escape the variables, then eval:

$string =~ s/(\\.)|([\$\@])/$2 ? "\\$2" : $1/gse; $new = eval qq{qq{$string}};

I can't offhand think of any way to introduce unwanted interpolation that this doesn't cover, but you'd obviously want to think about it more carefully than I if going this route. :)

Hugo