in reply to A single action from one or more items searched for
Just move your if outside the loop:
Or did I misunderstand your question?foreach $logrecord (@errorcheck) { open (LOGFILE, "$logrecord"); while (<LOGFILE>) { my $logline = $_; if ($logline =~ /$error/) { $errorcount++; } } } system ('page Mike') if $errorcount; print "$errorcount\n";
By the way, use != instead of ne when comparing numbers. Otherwise negative quantities will surprise you.
|
|---|