Doesn't select command selects the file and print the contents?
I used it as below in my code before:
my $in = $ARGV[0];
my $x = $ARGV[1];
my $y = $ARGV[2];
open IN , "<$in" or die $!;
open X, ">$x" or die $!;
open Y, ">$y" or die $!;
while (<IN>) {
if (/^>/) {
if (/infor_present:/) {
select X;
}
else{
select Y;
}
}
print;
}
In the above code, there is a "print" statement after it comes out of loop. So in order to print the contents in multiple files, how can we use print in this manner?
Also, I tried making a hash for the Sample.fa files with header as key and seq as values. But since I am reading multiple files, that approach is not working (as I run out of memory!). Kindly help.
Thanks!
|