# Now read the values from XREF into an array open XREF, "<$xref" or warn $!; @xreflines=; #remove the blank lines from the araary @xreflines = grep /\S/, @xreflines; print LOG "XREF lines are read into an array $now \n"; close XREF; #now read the good customer file created from VIPOUT and check against the XREF file and see whether the distributor/customer combination already exists. If not create a new file and this is the one that gets loaded into BW open CUSTOMERFILE, "<$out_file" or warn $!; @lines=; close CUSTOMERFILE; open XFILE, ">>$goodfile" or warn $!; foreach $line (@lines) { ($DISTID1,$CUST1,$junk)=split('\;',$line); chomp $DISTID1; chomp $CUST1; print LOG "\$xrefvalue is $xrefvalue \n"; $x=grep /$xrefvalue/, @xreflines; if ( $x == 0 ) { print LOG "\$x value is $x \n"; print LOG "\$line is $line \n"; print XFILE "$line \n"; } } close XFILE;