use XML::Twig; $str ='

THE ILIAD HOMER

BOOK I Sing, O goddess, the anger of Achilles son of Peleus, that brought countless ills upon the Achaeans.

'; $epath = 'new( twig_handlers => { $epath => sub { normal (@_, $relt)}, pretty_print => 'indented' ); $twig->parse("$str"); #$twig->print; sub normal { my ($twig, $elt, $relt) = @_; $elt->set_gi( "$relt" ); #$elt->print; } #### Error: unrecognized expression in handler: 'chap/ch/sec//anchor' at D:\ver\conversion.pl line 132