in reply to extract tag form xml file

Here is a one-liner for marto's use case (Windows cmd version):
perl -F\^" -ne "$a=$F[1] or next;open $x,qq|>> $a.mml|;print $x $_;clo +se $x" test1.xml
For linux, remove the "^", and you may substitute single quotes for double after -e.

This would be easier with the non-core module Path::Tiny and the like.

"Fragile" warnings apply.

                Memory fault   --   brain fried