Hi All, I have the below sample XML dump structure after reading it into XMLSimple: $VAR1 = { 'Response' => [ { 'RTAG' => 'closure47', 'UUID' => 'Group000', 'Group' => [ { 'NAME' => 'null', 'GroupRef' => [ { 'GID' => 'Canada' }, { 'GID' => 'United States' } ], 'GID' => 'Group000', 'TYPE' => 'SELLFIRM', 'Property' => [ { 'VALUE' => 'SELLFIRM' 'NAME' => 'Level' }, { 'VALUE' => 'Portfolio Type 1', 'NAME' => 'Portfolio Type' }, ............ ............ ........... The below codes loops through above and returns the correct 'GID' within the 'Group' nodes: my $i = 0; my $j = 0; foreach $e (@{ $data->{Response} }) { for ($i = 0; $i < scalar (@{$e->{Group}}); $i++) { #Loop through the 'Group' print "{Group}[$i]->{GID}: ", $e->{Group}[$i]->{GID}, "\n"; # get GID's } } Im trying to use the above to output the 'GID's within the 'Groupref' nodes, something along the lines of this: my $i = 0; my $j = 0; foreach $e (@{ $data->{Response} }) { for ($i = 0; $i < scalar (@{$e->{Group}}); $i++) { #Loop through the 'Group' print "{Group}[$i]->{GID}: ", $e->{Group}[$i]->{GID}, "\n"; # get GID's for ($j = 0; $j < scalar (@{$e->{Group}->{GroupRef}}); $j++) { #Loop through the 'Group' print "{Group}[$i]->{GroupRef}[$j]->{GID}: ", $e->{Group}[$i]->{GroupRef}[$j]->{GID}, "\n"; #'Canada' } } } but I get the below error: {Group}[0]->{GID}: Group000 Can't use an undefined value as an ARRAY reference at testXMLSimple.pl line 51. Clearly the portion of the for loop scalar (@{$e->{Group}->{GroupRef}}); ie trying to find the size of the array is causing the issue. If i replaced the for loop with something like for ($j = 0; $j < 10; $j++) ... ths would work but obviously as a test, I cant harcode the upper limit to 10! any ideas greatly appreciated? Kind regards Satnam Any ideas on how to find the size of the array in the line