@originalList = $originalList[0] = "ID" $originalList[1] = "PIN" #### open (ORGLIST, "<", $ARGV[1]); open (BEEPON, ">>", "beep_on.list"); open (BEEPOFF, ">>", "beep_off.list"); my $i = 0; foreach my $line (){ my $notLine = 0; open (DELLIST, "<", $ARGV[0]); foreach my $otherLine (){ if ($line eq $otherLine){ $notLine++; last; } } close (DELLIST); if ($notLine > 0){ print BEEPON $line; $i++; } elsif ($notLine == 0){ print $line; print BEEPOFF $line; } } close (BEEPON); close (BEEPOFF); print "Items removed $i \n"; close (DELLIST);