Using Perl XML::Twig, how can I loop on each sibling until reaching the last node ?
while (condition_sibling_TWIG, $v)
{
$v=$v->next_sibling;
$v->print;
# process $v
}
Should the condition be ($v != undef) ?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
next_siblingsto get the list of siblings:next_siblingsaccepts an optional condition as argument, which is an XPath step, or at least the subset of XPath supported by XML::Twig:$elt->next_siblings('p[@type="secret"]'))