I am not going to copy & paste my whole advice here, but it seems strange to me no one has yet recommended hashes over arrays for the tree construction.
In reply to Re: Convert array to tree OR why variable changes arbitrarily
by choroba
in thread Convert array to tree OR why variable changes arbitrarily
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |