http://qs321.pair.com?node_id=984385


in reply to Re^2: hash deref confusion: Intermediate Perl
in thread hash deref confusion: Intermediate Perl

I wouldn't really say it's a quirk. You're assigning a list of values to a list of hash slots, so the @ sigil is quite appropriate.

Sure, from that perspective it makes sense, but IIRC TheLarry himself called this a mistake, its why perl6 always calls a %hash a  %hash{$key} not  $hash{$key}

Replies are listed 'Best First'.
Re^4: hash deref confusion: Intermediate Perl
by tobyink (Canon) on Jul 30, 2012 at 08:30 UTC

    That's not specific to slices though. In Perl 6 sigils are not context-dependent; they are variable-dependent and context-invariant. In Perl 5, where sigils are used to indicate context, using @ for hash slices is pretty consistent with the rest of the language.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      .... using @ for hash slices is pretty consistent with the rest of the language

      It is, but its still quirky, look, there is a list on the right side:

      %hash = @list;

      @list = %hash;