This snippet searches a log file for errors and warnings. It outputs those errors and warnings to an array. I grab this array from another file to post it in an applications message display on reboot after a power bump. Please let me know if there is a shorter way to do this. I'm a beginner so any comments are appreciated.
#!/opt/perl5/bin/perl5.005 -w
#File Name: clean_start
#Author: ###
#
#Description: The purpose of this file is to search the #rc.log file
+for errors and warnings.
#status.
use diagnostics;
open RC, "/etc/rc.log"
or die "Can't open rc.log";
my @error = (grep /ERROR/i | /WARNING/i, <RC>);
@message = join 'clean_start:', @error;
print @message;
close RC;