> Here is what I have so far:
>
> open (FILE, ">>file2") || die "cannot open file2\n";
> open (OIDFILE, "file1") || die "cannot open file1\n";
> while (<OIDFILE>) {
> $new_oid = $_;
> while (<FILE>) {
You opened FILE for output here.
besides this is not too efficient, because you read the whole file2 over and
over again for each entry in file 1.
It would be better to read file2 once and store it in an array.
try this:
open (FILE2, <"file2") || die $!;
my @file2 = <FILE2>;
close FILE2;
open (FILE1, "<file1") || die $!;
open (FILE2, ">>file2") || die $!;
foreach $oldline (<FILE1>) {
print FILE2, $oldline unless grep{$_ eq $oldline}@file2;
}
close FILE1;
close FILE2;