@rec is an array of hashrefs, therefore $ref[0] is a hashref. The arrow is optional here, we have two possible ways to get the value of the kids key. The value is an arrayref, so we dereference it with @{} to get the array. And scalar applied to a listan array returns the number of elements in it.