title: Perl, how to parse XML file, xpath
body: <p>I want to parse an XML file using <strong>Perl</strong>. I was able to do it using the <strong>XML::Simple</strong> module, but now I want to start using the <strong>XML::XPath</strong> module instead because it uses <strong>XPath</strong> expressions. From my limited knowledge I think XPaths will make future parsing easier, right?
  Here's the Perl code I have so far:</p>
  
  <pre><code>use strict;
  use warnings;
  use XML::XPath;
  
  my $file = "data.xml";
  my $path = XML::XPath-&gt;new(filename =&gt; $file);
  
  my $name = $path-&gt;find('/category/event/@name');
  print $name."\n";
  </code></pre>
  
  <p>My question is how do I separate each name attribute (category/event/@<strong>name</strong>) 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 :-)</p>