in reply to Return second element

How would I get each $child->id into an array

With push or unshift or map. What did you try? How did it fail?

and then return the 2nd element in the array?

Seriously? Start with perlintro - it's right in there.