http://qs321.pair.com?node_id=46517

redbeard has asked for the wisdom of the Perl Monks concerning the following question: (regular expressions)

I have an XML document with multiple repetitive fields all in a single string, as obtained from a web service using LWP::Simple::get.

I would like to parse out those multiple repetitive values (e.g. <email> and <name>) and put them in their own arrays (e.g. @email and @name).

Example document content:

$xml = <<EOF; <xml> <email>toto@foo.com</email><name>Toto</name> <email>tata@bar.com</email><name>Tata</name> <email>tutu@baz.com</email><name>Tutu</name> </xml> EOF

Originally posted as a Categorized Question.