Hi perl monks,
I am fairly new to perl and have given an attempt to compare two text files, text file A contains several columns containing numbers, text file B contains a column of numbers that I need to match.
the 3rd column from text file A contains a unique value ($textpac3
) and that unique value may be in text file B ($text1).
If both unique values appear in both files and a number from column 11 ($textpac11
) matches the $text11
value from text file B then the results will print, however it doesnt seem to print correctly to the matches.txt file, please can someone help me?
my $A_file = 'A.txt';
my $B = 'B.txt';
my $matches ='matches.txt';
open (INPUT, $A_file) or die "ERROR: cannot find file $A_file\n";
open (OUT2, ">$matches");
@text1 = split /\t/,$_;
next if ($text1=~ /L1/gi);
open (OUT1, "$B");
@textpac = split /\t/,$_;
next if ($textpac=~ /OID/gi);
if($textpac eq $text1 && $textpac eq $text1)
print OUT2 join( "\t", @text1[ 1, 2, 3 ] ), "\n";