in reply to Find and replace using regex

$1 does not seem to work in the replacement.
because $1 from the m// is reset by the subsequent s///. You have to capture $1 in some variable:
$_ =~ /<FN1>([^<].+)<\/FN1>/; $found = $1; $_ =~ s/<FN1ref>/<FN1>$found<\/FN1>/g;

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}