in reply to replacing text with a function

I just wanted to point out that you don't need this matching code if $_ =~ m/\<REPLACE_TEXT_1\>/;. You can just perform the substitution as it will only substitute if <REPLACE_TEXT_1> is found:
$_ =~ s/<REPLACE_TEXT_1>/$replace_string/;
-- vek --