use strict; use warnings; my $linexml; my $cleanedXML; my $cleanedDomain; open (XML, 'domainList.xml'); while (my $xmlline = ) { $linexml = $xmlline; $cleanedXML = quotemeta $xmlline; open (DOMAINS, 'dead_domains.txt'); while (my $domainline = ) { $cleanedDomain = quotemeta $domainline; if ($cleanedXML =~ m/$cleanedDomain/) { $linexml = ''; last;} } close (DOMAINS); open (MYFILE, '>>new_domainList.xml'); print MYFILE "$linexml"; close (MYFILE); } close (XML);