#!/usr/lib/perl use strict; use warnings; use Carp; use File::Find; use File::Spec::Functions qw( canonpath ); my $date = `date`; if ( @ARGV == 0 ) { push @ARGV, "C:\\Users\\bijoymeethal\\Desktop\\xml test"; warn "Using default path $ARGV[0]\n Usage: $0 path ...\n"; } open( my $allxml, '>', "all_xml_contents.xml" ) or die "can't open output xml file for writing: $!\n"; print $allxml '', "\n"; find( sub { return unless ( /[.]log\z/i and -f ); extract_information(); return; }, @ARGV ); sub extract_information { my $path = $_; if ( open my $xmlin, '<', $path ) { local $_ = <$xmlin>; print $allxml $_ unless (( /<\?xml/) or ( /<\testResults/)) ; #print $allxml $_ unless ( /<\testResults/); while ( <$xmlin> ) { print $allxml $_; } } return; }