Why it's a syntax error:
my @hash{1..4}=(1..4);
but not this one:
my %hash;
@hash{1..4}=(1..4);
the 1st example is of a lexically scoped 'my' + a hash slice which pre-supposes that one can declare a hash in the manner of a slice which is not valid syntax. your 2nd example is appropriate, declaring the hash first, assuming that you're use'ing strict + warnings;