foreach my $pattern (@patterns) { if (-1 != index $line, $pattern) { push(@events, $line); last; } }