!#/usr/bin/perl -w use strict; use warnings; open (IN, "C:/Documents and Settings/devans/Desktop/grant_author_name_mapped.txt"); open (OUT, ">C:/Documents and Settings/devans/Desktop/grant_author_name_mapped_.txt"); $count; while (){ chomp; @t=split(/\t/,$_); $t[2]=~s/\(//gi; $t[2]=~s/\)//gi; $t[8]=~s/\(//gi; $t[8]=~s/\)//gi; ucfirst $t[2]; @b=split(/\ /,$t[8]); @a=split(/\ /,$t[2]); foreach (@a){ if ($_ and exists $b{$_}){ $count++; print "$count\n"; } } if ($count ge 3){ print OUT "$t[1]\t$t[2]\t$t[3]\t$t[4]\tY\t$t[6]\t$t[7]\t$t[8]\n"; } else{ print OUT "$t[1]\t$t[2]\t$t[3]\t$t[4]\tN\t$t[6]\t$t[7]\t$t[8]\n"; } } close OUT; close IN;