my %myref; for my $key (keys %{$ref->{charge}}) { $myref{$key} = $ref->{charge}->{$key}->{name}; }