my $re = join '|', @all; $re = qr/$re/; if ($line =~ /$re/) { print F2 $line; }