Assigning anonymous hash to a list

Matt Lawrence matt.lawrence at virgin.net
Tue Jul 30 20:14:28 BST 2013


Don't you need parentheses on both sides of that assignment? 


Sent from Samsung Mobile

-------- Original message --------
From: gvim <gvimrc at gmail.com> 
Date:  
To: London PM <london.pm at london.pm.org> 
Subject: Assigning anonymous hash to a list 
 
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