Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Converting Bracketted String (Newick's) into Array of Array

by busunsl (Vicar)
on Sep 04, 2008 at 06:22 UTC ( #708935=note: print w/replies, xml ) Need Help??


in reply to Converting Bracketted String (Newick's) into Array of Array

I'd go for something like this (untested):

# convert parens to brackets $str =~ tr/()/[]/; # quotes $str =~ s/(\w+)/'$1'/g; # eval my $aoa; $eval = '$aoa = ' . $str; eval $eval;