foreach $root do if !$children do @title, endif endforeach