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