use warnings; use strict; use XML::LibXML; my $doc = XML::LibXML->load_xml(location => 'foo.xml'); my @nodes = $doc->findnodes('//param[@name="SSLKeyStorePassword"]'); if (@nodes) { warn "found more than one SSLKeyStorePassword" if @nodes>1; $nodes[0]->{value} = 'BLABLA8'; } else { die "did not find SSLKeyStorePassword" } $doc->toFile('bar.xml', 1);