open(INDB, "exp.txt"); open(DATA, "qqq.txt"); while() { $search = $_; chomp($search); seek(INDB, 0, 0); while() { $therec = $_; chomp($therec); ($ma,$id ) = split(/\t/, $therec); if($id eq $search){ print " $ma\n "; } } }