in reply to Tree Data Structure
Try to change this:
if($$tree->{left} == undef || $$tree->{right} == undef) { return; } [download]
return unless defined $$tree->{left} and defined $$tree->{right}; [download]