#!/usr/bin/perl open(FH1,"file1.txt"); open(FH2,"file2.txt"); @array=; $jo=join("",@array); @spl=split("\n",$jo); while($line1=){ @hold=(); @coll=split("\t",$line1); #$len=$coll[1]-$coll[2]; #$len=~s/-//g; $hit=$coll[5]; @hold=grep(/$hit/,@array); $held=shift(@hold); if(defined $held){ ($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9)=split("\t",$held); print "$c1\t$c2\t$c3\t$c4\t$c5\t$c6\t$c7\t$c8\t$c9\n"; } else{ print "$coll[0]\t$coll[1]\t$coll[2]\t$coll[3]\t$coll[4]\t$coll[5]\t$coll[6]\t$coll[7]\t$coll[8]\n"; } }