in reply to purging of grandchildren in XML::Twig

The purge method belongs to the XML::Twig object, not to the XML::Twig::Elt objects the tags produce. That is what the error message tells you.

You probably want the delete() method of XML::Twig::Elt. Trusting you have the arguments as you want them,

sub mysub { my ( $t, $tag) = @_; for ($tag->children) { $_->delete() for $_->children; } 1; }
Note that the two $_ in the delete line are different. The one right of for belongs to the outer loop, the left to the inner. Somehow, it all works out ;-)

After Compline,
Zaxo