in reply to Re^2: Manipulating tab delimited file
in thread Manipulating tab delimited file
Hello andyBio,
It looks as though your first while loop constructs filename strings and prints them out; then, immediately before the second while loop, you want to open the last constructed filename for writing. If this is what you are doing, there are three problems:
(1) As Laurent_R says, $temp is out of scope by the time you try to use it in the open statement. To fix this, you need to give it a wider scope:
... my $temp; # declare $temp before the loop while (...) { ... } close FASTQIN; my %count_seq; open my $fh, ... # $temp is still in scope ...
(2) The statement my $temp = print $head, $seq; doesn’t do what you want it to, because print returns a boolean value indicating whether the print operation was successful or not. You need something like this:
$temp = $head . $seq; print $temp;
(3) The first while loop’s condition may never be true, in which case $temp will never be initialized; so you should test for this possibility:
close FASTQIN; my %count_seq; if (defined $temp) { open my $fh, '<:encoding(UTF-8)', $temp or die "Cannot open $temp +$!"; while (<$fh>) { ... } }
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|