in reply to beginner regex question
You can open the file handle outside of the first while loop also. Because, for each iteration it will open and close the files. This will increase the system load. You can avoid this by open the file outside of the loop and move the file pointer to the starting position for each iteration.
open INDAT, "file1" or die "$!"; my @array; my @probes; open INCOMP, "file2" or die "$!"; while (<INDAT>){ @array=split/\t/; while (<INCOMP>){ chomp ( $_ ); @probes=split/\t/; if ($array[0]=~/$probes[1]/i){ print $probes[1];#or whatever else } } seek INCOMP, 0 , 0; } close INCOMP;
|
|---|