# Building the array of terms: my @terms = (); while (my $term = ) { chomp $term; push @terms, $term; } #### # Printing sources that do not match of of the terms: while (my $source = ) { chomp $source; print "$source\n" unless grep { $source =~ /$_/ } @terms; }