Welcome to the Monastery | |
PerlMonks |
Re: trying to understand xml::twig and also trying to learn how to extract attributeby GrandFather (Saint) |
on Nov 04, 2008 at 23:27 UTC ( [id://721530]=note: print w/replies, xml ) | Need Help?? |
You're not a long way away from what you need to do. twig_roots supplies a reference to a sub to handle matching elements. Consider:
Prints:
Note that there were a few missing close " in your sample XML that I've fixed. Also notice that I created an anonymous sub so I could pass extra parameters into the handler thus avoiding the need for global variables. Perl reduces RSI - it saves typing
In Section
Seekers of Perl Wisdom
|
|