very informative back when I found hashes & hashrefs confusing.
Since children is an array, you should be able to just iterate over it with a
and perform any action that needs to be taken on each child, and increment a counter to count. Also, you can refer to an array in scalar context to get a count.