First, read
How do I post a question effectively? and
Writeup Formatting Tips - your question would be much easier to read with >code< tags.
As for your question, I found
The Perl hash How-To 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
foreach 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.