If you wanted to use XML::libXML then the following would point you toward the node you want:
in reply to searching the XML file for certain nodes
Then you can manipulate the rest all you want with the other functions (I would start with childnodes)
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($data);
my ($object) = $doc->findnodes("\/e\/p\[\@v=\"YES\"\]");
Hope this helps!
NOTE: I chose the double quotes in case you wanted to replace YES with a variable. Maybe . . .
my ($object) = $doc->findnodes("\/e\/p\[\@v=\"$criteria\"\]");