I have a directory containing 'x' no. of files. Some files contain a "Pass" string and some others with "Fail". I want to read both files and store the pass and fail files separately into two different directories. I am able to read the files but can not match the string.
#!/usr/bin/perl
use strict;
use warnings;
use Path::Class;
my $src = dir("/home/Narayanan/Cov_script/logs/");
my $pattern = "TEST IS PASSED";
my $i = 0;
my @log_files = grep /[.] log\z/x, $src->children;
for my $log_file ( @log_files ) {
my $in = $log_file->openr;
while (my $line = <$in>) {
my $string = $line;
#| `grep { $line eq $pattern } `
print "OUT: $string";
}
}