for( ref $doc->{Result} eq "HASH"?keys %{$doc->{Result}}:ref $doc->{Result}eq "ARRAY"?@{$doc->{Result}}:() ){