open IN, "){ $sID{$1} = 1 if /^(\w+)\t/; } close IN; open IN, "); while(@a = split /\t|$/, ){ print join "\t", @a[@cols],"\n"; } close IN;