Assigning anonymous hash to a list

gvim gvimrc at gmail.com
Tue Jul 30 19:54:46 BST 2013


Can anyone explain why this works:

my $ref = {a => 1,  b => 2, c => 3};
say $ref->{b};     #  Result: 2

... but this doesn't :

my ($str, $ref) = 'text', {a => 1, b => 2, c => 3};
say $ref->{b};   # Result: Use of uninitialized value

Seems a little inconsistent.

gvim


More information about the london.pm mailing list