in reply to Calling sub-routine in regex

> $_ =~ s/$regex_2/$+{group_x}$+{group_y} changer($+{text})/e;

as you said ...

> I think I've understood that the right-side of the s/// needs to be code only

... the RHS must be parsed as code.

Hence please try

"$+{group_x}$+{group_y}" . changer($+{text})

or

$+{group_x}  . $+{group_y} . changer($+{text})

If that's not your issue, please try to shorten your description, (TL;DR ;-)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

PS: people will tell you to use a HTML parser module. ( yep ;-)