in reply to stop me from embarrassing myself

here is the latest version, with all of the great changes that have been suggested; thanks so much to everyone for your help!

: # -*- perl -*- eval "exec perl -S $0 $*" if $running_under_some_shell; #===================================================================== # errreporter - mails interesting entries from the AIX error log #===================================================================== use strict; use File::Basename; use Getopt::Std; # declare vars in the conf file ... my ($email, @ignore); # declare some other vars used below ... my ($identifier, $timestamp, $resource, $description, @error); my $me = basename($0); chomp (my $hostname = `/usr/bin/hostname`); my @usage_string = <<ENDOFUSAGESTRING; Usage: $me [-hul] [-f file] Run "$me -h" for additional information. ENDOFUSAGESTRING my %opts; getopts('hulf:', \%opts) or die @usage_string; if ($opts{h} || $opts{u}) { exec "perldoc $0" }; if ($opts{l}) { exec '/usr/bin/errpt', '-t' or die "$me: couldn't exec 'errpt -t'\n +" }; my $conf = $opts{f} || "/etc/errreporter.conf"; eval `/usr/bin/cat $conf 2> /dev/null` or die "$me: couldn't read specified conf file $conf\n"; unless (defined ($email)) { die "$me: email not defined " } # add the errpt header line to the ignore list ... push (@ignore, "IDENTIFIER"); # get the current time, in the form used by the errpt command ... my $starttime = sprintf '%02d%02d%02d%02d%02d', sub { $_[4]+1, $_[3], $_[2], $_[1], $_[5] % 100 } -> (localtime); print STDOUT "$me: starting errreporter at $starttime, using conf file + $conf.\n"; # open an errpt process, reading the summary of errors posted # after the start time of this script ... open (ERRPT, "/usr/bin/errpt -c -s $starttime |") or die "$me: couldn't open errpt for reading!\n"; # while the above process is open ... while (<ERRPT>) { chomp; # split the errpt entry into fields ... ($identifier, $timestamp, undef, undef, $resource, $description) = split (/\s+/, $_, 6); my $ignore = 'no'; foreach (@ignore) { # check to see if the entry is on the ignore list ... if ($identifier =~ /$_/) { $ignore = 'yes' ; last } }; unless ($ignore eq 'yes') { # store the full entry in the array @error ... @error = `/usr/bin/errpt -a -s $timestamp`; # add a subject line to the @error array ... unshift (@error, "Subject: $hostname -- $resource -- $descript +ion\n"); # and send the e-mail ... open (SENDMAIL, "|/usr/sbin/sendmail $email") or die "$me: couldn't open sendmail: $!"; print SENDMAIL @error; close (SENDMAIL); }; }; #===================================================================== =pod =head1 NAME ... cut out the pod, which hasn't changed ... =cut