in reply to how to grep from a log file

The syntax for grep is shown in the documentation:

grep BLOCK LIST grep EXPR,LIST

But you used

grep ': FAIL' $logFile

Adding a comma will fix the syntax error, but the code won't do what you want. Grep iterates over the elements of the list, but you gave it just the file name. You need to supply the file contents instead.

Also, you specified a string as the expression. The string is always true, so grep will return all the lines regardless of what they contain. You need to use a regular expression match or index:

open my $fh, '<', $logFile or die $!; my $status = grep /: FAIL/, <$fh>; # or my $status = grep { -1 != index $_, ': FAIL' } <$fh>;

Or maybe, you wanted to run the external command grep instead of the Perl's grep?

my $status = system 'grep', ': FAIL', $logFile;

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]