in reply to Re: how to output the final Tree into a file?
in thread how to output the final Tree into a file?

I did that

my $outfile = 'C:\Users\Ioulia\Desktop\outree.tre'; my $treeout = Bio::TreeIO->new(-format => 'newick', -file => ">$outfil +e");

But I get this: "my" variable $treeout masks earlier declaration in same scope at....line 50.

Then I can normaly run the script but an empty file outree.tre is created.

please excuse me but I m really new and it takes me a long time to understand many things

Replies are listed 'Best First'.
Re^3: how to output the final Tree into a file?
by Anonymous Monk on Mar 15, 2016 at 23:58 UTC

    please excuse me but I m really new and it takes me a long time to understand many things

    :) fragments which don't reproduce the error message, don't reproduce the error message -- you can't learn about the error message from those :)

    diagnostics/perldiag/splain

    perl -we" my $foo = 1; my $foo = 2; " "my" variable $foo masks earlier declaration in same scope at -e line +1. $ perl -Mdiagnostics -we" my $foo = 1; my $foo = 2; " "my" variable $foo masks earlier declaration in same scope at -e line +1 (#1) (W misc) A "my", "our" or "state" variable has been redeclared in +the current scope or statement, effectively eliminating all access to +the previous instance. This is almost always a typographical error. +Note that the earlier variable will still exist until the end of the sc +ope or until all closure referents to it are destroyed.
      ok i can understand that i have already declared $treeout before. But I think that all the information of the tree that i need is stored in $treeout and i cant use it. Just emptying $treeout with undef has no point at all.

        That's right. Did you try:

        while ( my $tree = $treeout->next_tree ) { for my $node ( $tree->get_nodes ) { printf $fh "id: %s bootstrap: %s\n", $node->id || '', $node->b +ootstrap || '', "\n"; } }

        The way forward always starts with a minimal test.

        ok i can understand that i have already declared $treeout before. But I think that all the information of the tree that i need is stored in $treeout and i cant use it. Just emptying $treeout with undef has no point at all.

        Ah, ok, now instead of code fragments, we're going with thought fragment?

        Why don't you post the whole code?