http://www.perlmonks.org?node_id=480723


in reply to Re: Hash and arrays
in thread Hash and arrays

Or, in a similar way, use a hash slice to populate the hash

#!/usr/bin/perl use strict; use warnings FATAL => "all"; use Data::Dumper; my @k = ("a", "b", "c"); my @v = (1, 2, 3); my %h; @h{@k} = @v; print Dumper \%h; __END__ output $VAR1 = { 'c' => 3, 'a' => 1, 'b' => 2 };

cheers

thinker