in reply to Substitution problem
Try something like
#Replace greetings value my $hash = sub { exists($hash{$2}) ? $hash{$2} : $1 }; $value =~s/(-(\S+?)-)/&$hash()/ge; [download]