neversaint has asked for the wisdom of the Perl Monks concerning the following question:
into this data structuremy $str = "((mouse,rat),(human,chimp))"; my $str2 = "(mouse,(human,chimp))";
The following code of mine doesn't work:my $aoa = [['mouse','rat'],['human','chimp']]; my $aoa2 = ['mouse',['human','chimp']];
my $str = "((mouse,rat),(human,chimp))"; $str =~ s/\(/\[/g; $str =~ s/\)/]/g; print "$str\n"; my $aoa = eval($str);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Converting Bracketted String (Newick's) into Array of Array
by ikegami (Patriarch) on Sep 04, 2008 at 06:15 UTC | |
|
Re: Converting Bracketted String (Newick's) into Array of Array
by psini (Deacon) on Sep 04, 2008 at 11:10 UTC | |
|
Re: Converting Bracketted String (Newick's) into Array of Array
by busunsl (Vicar) on Sep 04, 2008 at 06:22 UTC | |
|
Re: Converting Bracketted String (Newick's) into Array of Array
by betterworld (Curate) on Sep 04, 2008 at 14:50 UTC |