Port binary search tree to perl