in reply to Using a hash with the @ sigil

It's so called "hash slice".
use warnings; use strict; use Data::Dumper; my @arr = qw( a b c ); my %h; @h{@arr} = (3, 4, 5); # @hash{keys} = values print Dumper(\%h); __END__ Output: $VAR1 = { 'c' => 5, 'b' => 4, 'a' => 3 };
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Using a hash with the @ sigil
by 1nickt (Canon) on Jul 25, 2015 at 01:05 UTC

    Thanks choroba and all the other monks who replied...

    The way forward always starts with a minimal test.
Re^2: Using a hash with the @ sigil
by Anonymous Monk on Jul 25, 2015 at 14:25 UTC
    Hash slices are useful, but assigning a scalar to them is less useful. Perl could warn in that case, but I don't know that it should.
    @hash{@array} = 'foo'; # converted to a 1-element list @hash{@array} = ('foo'); # equivalent @hash{@array} = ('foo', undef, undef); # equivalent @hash{@array} = ('foo', 'foo', 'foo'); # arguably should be equivalent