UtopianTree-perl

Solved it in perl.