fdillon has asked for the wisdom of the Perl Monks concerning the following question:
I have been trying to get this short script to print out a suffix tree to a .txt file, so that I might process the tree (looking for the longest repeated subsequence). On Windows XP:
The script comes packaged (as a Synopsis) with davido's SuffixTree.pm. It works fine but outputs only to the screen. I tried to print $tree to a .txt file as shown above, and got this output:#!/usr/bin/perl; use SuffixTree; use warnings; use strict; my $filename7 = "C:\\MB\\Cp\\mississippi_out_7.txt"; open(MY7, ">>$filename7") or die "Unable to open $filename7: $!\n"; my $str="catgatgttttccctatgggatttttgaa"; my $tree=create_tree($str); print_tree($tree); my $position = find_substring($tree, "ttttg"); printf("\nPosition of (ttttg) in the sequence is %ld.\n\n", $p +osition); print MY7 "$tree"; #tried to output to .txt print MY7 "${$tree}"; #tried to dereference exit 0;
The attempt to dereference and output yielded:_p_SUFFIX_TREE=SCALAR(0x224fa4)
to <STDIN> and to the output file.2273160
Is there a simple way to do this?
Many thanks,
fdillon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing out to a .txt file.
by ikegami (Patriarch) on Apr 07, 2005 at 22:02 UTC | |
|
Re: Printing out to a .txt file.
by Roy Johnson (Monsignor) on Apr 07, 2005 at 22:02 UTC | |
|
Re: Printing out to a .txt file.
by tlm (Prior) on Apr 07, 2005 at 22:12 UTC | |
|
Re: Printing out to a .txt file.
by graff (Chancellor) on Apr 08, 2005 at 02:41 UTC | |
|
Re: Printing out to a .txt file.
by polettix (Vicar) on Apr 08, 2005 at 12:38 UTC | |
|
Re: Printing out to a .txt file.
by fdillon (Novice) on Apr 10, 2005 at 09:22 UTC |