There is no built-in syntax, but you can always write your own:
my $value = sub {map {$_ => $_[1]} @{$_[0]}}; my $hash = { [qw(abc)]->$value('valA'), [qw(def)]->$value('valB'), }; say join ', ' => map "$_: $$hash{$_}", sort keys %$hash;
If you are going to do this a lot, you may need the Hash::Util hv_store , which allows you to load multiple keys with exactly the same memory location.
Eric Strom
source share