What have you tried?
Actually for something like that I might use XML::Parser instead. Try a super search and see what you can find, there's been a bunch of relevant stuff recently.
Some of the answers to trying to understand xml::twig and also trying to learn how to extract attribute ought to be of help. In fact with minor work the code in Re: trying to understand xml::twig and also trying to learn how to extract attribute pretty much oes what you want already.
Perl reduces RSI
- it saves typing