#!/usr/local/it/bin/perl -w # # Create sample file with two # instances of "FAILED" string # $RFILE="example_file"; open(F1,">$RFILE") or die "cannot open $RFILE for creation!\n"; print F1 "FAILED\nPASSED\nPASSED\nFAILED\nPASSED\n"; close(F1); # # Open file for Append AND read # open(RESULT,"+>>$RFILE") or die "cannot open $RFILE\n"; # # Set an array to the filehandle and count the # number of lines with the "FAILED" string # my @result_array = ; $number_failures = grep /FAILED/, @result_array; # # Overall status is FAILED if any "FAILED" strings # are found # $OVERALL_STATUS = ($number_failures > 0) ? "FAILED":"PASSED"; print "+-------------------+\n"; print "| |\n"; print "| EO_FAIL_03 $OVERALL_STATUS |\n"; print "| |\n"; print "+-------------------+\n"; close(RESULT);