I suspect that $1{$2} is recognized as addressing an associative array, but I could not find any mention in the documentation about such an expansion in the substitution part of a RE.
See Quote and Quote like Operators:
... In the following table, a {} represents any pair of delimiters you choose.Customary Generic Meaning Interpolates ... s{}{} Substitution yes* ... * unless the delimiter is ''.
Where "interpolates" means the same thing as what happens to strings in double quotes, like "$hash{$key}", or, in your case, "$1{$2}". The error message gives you a hint: "Use of uninitialized value within %1 in substitution iterator" - so yes, $1{$2} means the same as $x{$y}, that is, access the hash %1 and fetch the key named by the string stored in $2. Your solution of adding the backslash is fine.
In reply to Re: Brace in the replacement part of a regular expression substitution
by haukex
in thread Brace in the replacement part of a regular expression substitution
by luc.bouge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |