in reply to organizing directory path data

print " " x ( 2 * @singleDirs ), $singleDirs[ -1 ], "\n";

Update: Of course that presumes that your list of directories is already sorted and complete (e.g. if there's a Foo/Blork there's already been Foo).