use strict; use warnings; use feature qw( say ); use XML::LibXML qw( ); use XML::LibXML::XPathContext qw( ); my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($qfn); my $xpc = XML::LibXML::XPathContext->new($doc); $xpc->registerNs('xi', 'http://www.w3.org/2001/XInclude'); for ($xpc->findnodes('//xi:include/@href')) { say $_->getValue(); } #### for ($xpc->findnodes('//xi:include')) { say $_->getAttribute('href'); }