my $main_re = join '|', map "(?:$_)", @REGEXPS; my $idx = 0; while($idx <= $#SYSLOG) { splice( @SYSLOG, $idx, 1 ) and $idx-- if $SYSLOG[$idx] =~ $main_re; $idx++; }