sub breadthFirst { my ($tree) = @_; return unless defined $tree; my @queue = ($tree); print $tree->{Value}; while (@queue) { my $node = shift @queue; print $node->{Value}; push @queue, $node->{Left} if defined $node->{Left}; push @queue, $node->{Right} if defined $node->{Right}; } }