Help for this page
s/(\$\w+)/exists $variables{$1} ? $variables{$1} : $1/ge;
s/(\$(\w+))/exists $variables{$2} ? $variables{$2} : $1/ge;