foreach my $node ($nodeset->get_nodelist) { #this line below is just for checking, what can be found within the nodelist my $a = $node->getAttribute('a'); my $b = $node->getAttribute('b'); my $c= $node->getAttribute('c'); if((defined $a) && (defined $b) && (defined $c)) { @arr_a = split (/ /, $a); @arr_b = split (/ /, $b); @arr_c = split (/ /, $c); }else{ print "Warning! \n"; } %complete =( @arr_a=>[@arr_b, @arr_c], ); } print Dumper %complete;