Copy array to hash

perl

Solution

my %questions = map { $_ => undef } @u_list;

In the map, each element of `@u_list` gets set to $_.

Problem

I'm trying to copy an array to a hash, such that each element of the array is a key, followed by an empty value. ``` my %questions = map { @u_list => $_ } @u_list; ``` This only prints out ``` => ``` I see on perldoc this idiom: ``` %hash = map { get_a_key_for($_) => $_ } @array; ``` But I cannot figure out how to set the keys. I want the keys to be each element in the array.

Original source