# perl Overlaps.pl STR.txt IQ_meta_242loci.txt > Output.xls open (IN2,"$ARGV[1]"); while (){ chomp;@lines=split ("\t",$_); $Start=int($lines[1]/1000);$End=int($lines[2]/1000); foreach $n($Start..$End){ $ChrPos="$lines[0] $n"; $leadSNP{$ChrPos}=$lines[4]; } } close (IN2); open (IN1,"$ARGV[0]"); while (){ chomp;@lines=split ("\t",$_);$Result=0; $Start=int($lines[1]/1000);$End=int($lines[2]/1000); HERE:foreach $n($Start..$End){ $ChrPos="$lines[0] $n"; $Leader=$leadSNP{$ChrPos}; if (defined($Leader)){ print "$Leader\t$_\n";$Result=1;last HERE; } } if ($Result==0){ print "NotFound\t$_\n"; } } close (IN1);