Q&A

Q1:XML::Simple isn't reading my XML correctly! I'm getting errors about well-formed documents. What does this mean?
A1: XML documents should be well-formed. This means that there are matching opening and closing tags for every element, that they're correctly nesting, attributes are quoted, and that there are no stray XML characters inside of the element's data. If your XML document violates any of these rules, all XML parsers are supposed to stop. That's one big difference between reading XML with a regular expression and with a real parser. Fix your XML document and try again!
Q2:XML::Simple isn't returning hashes where I'd expect it to, and I can't figure out the document structure.
A2: Use Data::Dumper as shown in Listing 19.8 to figure ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.