I've actually been able to test if it is defined in one step which enabled me to keep the original code structure:if (defined $elt->att('fq') && $la->att('fq') eq '0') does what I need.
just to show that there is indeed "more than one way to do it" in Perl, I have spotted in another piece of code written usingXML::Twig one of my colleagues used the start tag function and looked for the string "fq=" which would also work but is not as elegant as using defined in my opinion.
In reply to Re^2: XML::Twig - how can I test for an attribute when the attribute value is 0?
by mertserger
in thread XML::Twig - how can I test for an attribute when the attribute value is 0?
by mertserger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |