sub as_arrayref { my ($self) = @_; [$self->key, [map { $_->as_arrayref } @{$self->children}], $self->leaf]; }