my $pattern = join '|', map{"\Q$_\E"}@search_terms; while(my $suspect = ){ chomp($suspect); if( $suspect =~ /$pattern/o ){ push @delete_me, "$base_path$term"; } } #### foreach (@file_list){ # don't bother putting $_ here print $_, '
'; }