http://www.perlmonks.org?node_id=927965


in reply to Re^2: XML::Twig removing tags from content (XML::Twig)
in thread XML::Twig removing tags from content

To answer my own question, using reverse seems to fix the problem:

for my $p ($elt->children('p')) { for my $c (reverse($p->cut_children())) { $c->paste($elt); } $p->delete(); }

I don't understand why it's needed, but it works.