mardi 3 juin 2014

Perl: Convert array of keys and values into a hash


Vote count:

0




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.



asked 41 secs ago

Wernfried

1,979





Aucun commentaire:

Enregistrer un commentaire