in reply to LibXML error when trying to delete a node in DOM

$book->removeChild($a);

It's a bit hard to tell because you haven't used <code> tags around your code, but I don't see where you are assigning any value to $a so it is probably undef when you try to use it as an argument to removeChild().

Also, please don't use $a as a variable name - it has a special meaning for sort and can bite you if you are not careful.

Replies are listed 'Best First'.
Re^2: LibXML error when trying to delete a node in DOM
by bliako (Abbot) on Apr 26, 2019 at 13:53 UTC

    after the ergonomic intervention of monk Athanasius, I can also see the use of $a instead of $a[0].