in reply to Printing out to a .txt file.

OK, this is a shot in the dark, but it's simple enough that it's worth trying. It's banking on the possibility that print_tree may be printing to the currently selected handle, as opposed to printing explicitly to STDOUT or to who knows what else:

my $str="catgatgttttccctatgggatttttgaa"; my $tree=create_tree($str); my $filename7 = "C:\\MB\\Cp\\mississippi_out_7.txt"; open(MY7, ">>$filename7") or die "Unable to open $filename7: $!\n"; my $orig = select(MY7); print_tree($tree); select($orig);
See select for more details. Note however that select is unusual in that it has two completely different meanings in Perl; here I'm using the select that operates on filehandles (obviously), not the one that operates on bit vectors.

the lowliest monk