I want to parse an XML file using Perl. I was able to do it using the XML::Simple module, but now I want to start using the XML::XPath module instead because it uses XPath expressions. From my limited knowledge I think XPaths will make future parsing easier, right? Here's the Perl code I have so far:
use strict;
use warnings;
use XML::XPath;
my $file = "data.xml";
my $path = XML::XPath->new(filename => $file);
my $name = $path->find('/category/event/@name');
print $name."\n";
My question is how do I separate each name attribute (category/event/@name) so that I can perform tests on each value I parse. At the moment I'm just getting a big string full of the parsed data, whereas I want several small strings that I can test. How can I do this? Thanks :-)