Guest_imported
New member
- Jan 1, 1970
- 0
I have two lists (three actually but that is not relevant as I can repeat the process with the third file) of my customers email database. ALL PEOPLE ON THE LIST REQUESTED INFORMATION, DON'T START TELLING ME ABOUT SPAM PLEASE.
There are duplicates between the files, but each file iteself does not contain any duplicates. They are huge, 30,000 lines, one entry per line followed by a semi colon( ; )
example:
joe@joe.com;
frank@frank.net;
I just need to search one file for the contents of another line by line. If contents exists, move on, else concatenate it to the $endz.
The only thing is it does not search the array for some reason? Anyone know how to search an array for a string of text?
Note: the script is set up for testing, the final version will only write to file, not to the screen output.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open(INITX, "file1.txt"
;
@info=<INITX>;
close(INITX);
open(INITY, "file2.txt"
;
@initb=<INITY>;
close(INITY);
$a=0;
$b=0;
$c=0;
$d=0;
$endz = "";
foreach (@info) {
print "$info[$a]";
$a++;
}
print "<hr>";
print "@initb";
print "<hr>";
foreach (@info) {
if (@initb =~ m/$info[$c]/) {
print "<font color=red>$info[$c]</font>";
$c++;
}
else {
$endz = $endz . "\n" . $info[$c];
print "$info[$c]";
$c++;
}
}
print "<hR>";
print "$endz";
I AM PRETTY SURE THE PROBLEM LIES IN if (@initb =~ m/$info[$c]/) ANY IDEAS ON HOW TO PROPERLY SEARCH AN ARRAY?
There are duplicates between the files, but each file iteself does not contain any duplicates. They are huge, 30,000 lines, one entry per line followed by a semi colon( ; )
example:
joe@joe.com;
frank@frank.net;
I just need to search one file for the contents of another line by line. If contents exists, move on, else concatenate it to the $endz.
The only thing is it does not search the array for some reason? Anyone know how to search an array for a string of text?
Note: the script is set up for testing, the final version will only write to file, not to the screen output.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open(INITX, "file1.txt"
@info=<INITX>;
close(INITX);
open(INITY, "file2.txt"
@initb=<INITY>;
close(INITY);
$a=0;
$b=0;
$c=0;
$d=0;
$endz = "";
foreach (@info) {
print "$info[$a]";
$a++;
}
print "<hr>";
print "@initb";
print "<hr>";
foreach (@info) {
if (@initb =~ m/$info[$c]/) {
print "<font color=red>$info[$c]</font>";
$c++;
}
else {
$endz = $endz . "\n" . $info[$c];
print "$info[$c]";
$c++;
}
}
print "<hR>";
print "$endz";
I AM PRETTY SURE THE PROBLEM LIES IN if (@initb =~ m/$info[$c]/) ANY IDEAS ON HOW TO PROPERLY SEARCH AN ARRAY?