for my $key ( keys %HvA ) { $hash_neu{$_} = $key for @{ $HvA{$key} }; } # for