... my $outfile = '/path/to/file/to/create'; my $treeout = Bio::TreeIO->new(-format => 'newick', -file => ">$outfile"); ...