use XML::LibXML;
my $string = q|
IBM Tivoli Workload Scheduler for Applications
IBM
8.6.0.0
|;
my $tree = XML::LibXML->load_xml(string => $string);
open (my $out_xml,">",'out.xml') or die "with nice message: $!";
print $out_xml qq|All the hardcoded stuff\n|;
my @nodes = $tree->findnodes('/IPDetails');
for my $node (@nodes) {
my $product_name = $node->findvalue('productName');
my $vendor_name = $node->findvalue('vendorName');
my $version = $node->findvalue('version');
print $out_xml qq|\n|;
print $out_xml qq|\n|;
print $out_xml qq|\n|;
}
print $out_xml qq|End stuff\n|;
close $out_xml;