in reply to Substitutions if hash entry exists
s/(\$\w+)/exists $variables{$1} ? $variables{$1} : $1/ge; [download]
s/(\$(\w+))/exists $variables{$2} ? $variables{$2} : $1/ge; [download]