Here I write Perl code but in if condition, used \n
new line character not match.
#!/usr/bin/perl
use strict;
#use warnings;
use Cwd;
use File::Basename;
use File::Copy;
my $path = getcwd;
#print $path."\n";
opendir( INP, "$path\/" );
my @out = grep( /.(xml)$/, readdir(INP) );
close INP;
#print @out;
open( F6, ">Log.txt" );
foreach my $f1 (@out) {
open( FF, "<$path\/$f1" ) or die "Cannot open file: $out[0]";
my $data1 = join( "", <FF> );
my @FILE_KA_ARRAY = split( /\n/, $data1 );
my $file_ka_len = @FILE_KA_ARRAY;
#print F6 $file_ka_len."\n";
#print F6 $f."\t".$file_ka_len."\n";
print F6 $f1 . "\n";
for ( my $x = 1; $x < $file_ka_len; $x++ ) {
my $y = $x + 1;
my $temp_file_arr = "";
$temp_file_arr = $FILE_KA_ARRAY[$x];
#print F6 $temp_file_arr."\t$x\n";
my $temp1 = $temp_file_arr;
if ( $temp1
=~ m#(<list .*? depth="(\d+)">)\n?(<list .*? depth="(\d+)">)#gs )
{
my $list3 = $1;
print F6 "\t\t\t\t\t\t\t\t" . $y . "\t\t" . $list3 . "\n";
}
}
}