#!/usr/bin/perl use strict; use warnings; use XML::LibXML; my $parser = XML::LibXML->new; my $dom = $parser->parse_file( 'test.xml' ); # load file my @wanted_nodes = $dom->findnodes( './/an/xpath/here' ); # select print $_->toString for @wanted_nodes; # output