Hello, Monks! Please, one more question. I didn't think I should start a new thread for this.
while(
defined(my $head = <FASTQIN>) &&
defined(my $seq = <FASTQIN>) &&
defined(my $qhead = <FASTQIN>) &&
defined(my $quality = <FASTQIN>)
){
substr($head, 0, 1, '>');
my $temp = print $head, $seq;
}
close (FASTQIN);
my %count_seq;
open my $fh, '<:encoding(UTF-8)', $temp or die "Cannot open $temp
+$!";
while (<$fh>) {
chomp;
next if /^>/;
next if length($_) > 30 or length($_) < 15;
$count_seq{$_}++;
}
this is a section of code I am trying to write. Is there a way to make the variable my $temp that was used in the while loop also available in the open filehandle statement?
The code works OK till close (FASTQIN);. the error reads:
Use of uninitialized value $temp in open at test.pl line 44.
Use of uninitialized value $temp in concatenation (.) or string at tes
+t.pl line 44.
Cannot open No such file or directory at test.pl line 44.
Line 44 is this:
open my $fh, '<:encoding(UTF-8)', $temp or die "Cannot open $temp $!";
Kindly advise, monks! Thanks! |