in reply to A single action from one or more items searched for

Just move your if outside the loop:

foreach $logrecord (@errorcheck) { open (LOGFILE, "$logrecord"); while (<LOGFILE>) { my $logline = $_; if ($logline =~ /$error/) { $errorcount++; } } } system ('page Mike') if $errorcount; print "$errorcount\n";
Or did I misunderstand your question?

By the way, use != instead of ne when comparing numbers. Otherwise negative quantities will surprise you.