my $xquery = '//metadata/audience/@name';# find the first my $xquery2 = "//othermeta[\@name = 'plugin.id']/\@content";# find an othermeta with a name = plugin.id and @content my $xquery3 = '//@xml:lang'; # find first @xml:lang my $xparser = XML::LibXML->new(); # create new parser object eval { $xmldoc = $xparser->parse_file($file) }; # trap parsing errors that can't be suppressed normally, like   entities if ($@){ print "Problems! \n The error(s):\n$@\n"; } if ($pluginname = $xmldoc->findvalue( $xquery2 )){ # returns value of plugin name print " Plugin name found: $pluginname\n"; }