use XML::LibXML; #Parse XML my $template = 'xmldocument.xml'; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($template); #Find desired node(s) my @nodes= $doc->findnodes("//genre"); #Put results in array my @information; for(@nodes) { my $data = $_->textContent; push (@information,$data); }