Hi,
I'm new to Perl... I have some questions to extract the data out.
I have two files. One is gene list, and the other is the whole data(having gene lists and other values).
I'd like to extract the informations of the input lists.
I tried... but the RESULT file is empty!! I don't know what's wrong...
Here is my code.
Thanks!!!
I'm new to Perl... I have some questions to extract the data out.
I have two files. One is gene list, and the other is the whole data(having gene lists and other values).
I'd like to extract the informations of the input lists.
I tried... but the RESULT file is empty!! I don't know what's wrong...
Here is my code.
Code:
#!/usr/bin/perl
open(Data,"data.txt");
@all = <Data>;
close(Data);
open(List,"list.txt");
@list = <List>;
close(List);
open(ANS,">result.txt");
for($j=0;$j<$#list;$j++){
chomp($list[$j]);
}
for($i=0;$i<$#all;$i++){
@b=split("\t",$all[$i]);
for($j=0;$j<$#list;$j++){
if($b[0] eq $list[$j]){
print ANS "$all[$i]";
}
}
}
close(ANS);
Thanks!!!
Comment