Perl: Convert array of keys and values into a hash
arrays, hash, perl
Solution
Use a hash slice,
my %hash_table;
@hash_table{@keys} = @values;
using map,
my %hash_table = map { $keys[$_] => $values[$_] } 0 .. $#keys;
Problem
I have two arrays like this ``` my @keys = qw/Key_1 Key_2 Key_3/; my @values = qw/foo bar more/; ``` Is there a short way (i.e. a single function) to get a hash like this without using a loop? ``` my %hash_table = ( Key_1 => "foo", Key_2 => "bar", Key_3 => "more" ); ``` I tried to use `map` function but no success.