Assigning anonymous hash to a list

Joseph Werner telcodev at gmail.com
Tue Jul 30 20:09:19 BST 2013


It is because you are not assigning a list value to a list.  You are
assigning a scalar value that is the result of a ',' expression  to
the first element in the list.

Hope this helps.

Christian

On Tue, Jul 30, 2013 at 2:54 PM, gvim <gvimrc at gmail.com> wrote:
> 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



-- 
Best Regards,
[Joseph] Christian Werner Sr
C 360.920.7183
H 757.304.0502
Txt 757.304.0502


More information about the london.pm mailing list