I told you it was untested! ;--)
Of course at some point you get to the last child, and $aheadtext->next_sibling; doesn't exist, so $more_text becomes undef.
So the test should not be while( $more_text->tag ne 'shead'), which will die when you trying to call the tag method on the undef value in $more_text, but while( $more_text && ($more_text->tag ne 'shead')).
Does that help?
In reply to Re^3: XML::Twig - extracting some tags from siblings
by mirod
in thread XML::Twig - extracting some tags from siblings
by aakikce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |