in reply to how to evaluate a variable in a string?

Similar to fglock's first answer except for the variation:
$file=~s/$from/eval'"'.$to.'"'/sge;