# Add attribute "xxx" with value "yyy" to # the first (idx 0) "B" child of node $doc. $doc->{B}[0]{xxx} = 'yyy';