Purely Functional AA Tree in Perl