in reply to Substitution problem

Untested:
s{(-(.+?)-)}{$hash{$2} // $1}eg;
This assumes 5.10 or later.