Not an answer, but in all the answer examples given the XML source is not proper XML (at least for this purpose). Sure there are 'email' tags and there are 'name' tags but there's no 'email/name' container gluing the two together. At best you can only guarantee that the sample can be parsed into an array of emails and an array of names, but making assumptions that there is an association between the email and name is eventually going to bite you.
Here's a 'functionally' equivalent source sample:
my $_='<xml>
<email>toto@foo.com</email>
<email>tata@bar.com</email>
<email>tutu@baz.com</email>
<name>Toto</name>
<name>Tata</name>
<name>Tutu</name>
</xml>';
And so is this:
my $_='<xml>
<email>tata@bar.com</email>
<email>toto@foo.com</email>
<name>Tutu</name>
<email>tutu@baz.com</email>
<name>Toto</name>
<name>Tata</name>
</xml>';
The examples above are both valid representations of the original source sample and I'm pretty sure XML parsers are within their design rights to re-organize the data as they see fit.
A better source for example answer code would be this:
my $_='<xml>
<user><email>toto@foo.com</email><name>Toto</name></user>
<user><email>tata@bar.com</email><name>Tata</name></user>
<user><email>tutu@baz.com</email><name>Tutu</name></user>
</xml>';
Originally posted as a Categorized Answer.