Assigning anonymous hash to a list

Joseph Werner telcodev at gmail.com
Wed Jul 31 04:08:34 BST 2013


Careful,  the hounds are loose tonight!

On Tue, Jul 30, 2013 at 10:36 PM, Hernan Lopes <hernanlopes at gmail.com> wrote:
> sorry i meant 1 thing on the left and one thing on the right. Both are
> lists and should be the same size.
>
> On 7/30/13, Hernan Lopes <hernanlopes at gmail.com> wrote:
>> When you do that, you are implicitly saying:
>>
>> The thing on the left is equals the thing in the right.
>> So, in the left you have 1 thing ( a list because of parenthesis ),
>> and on the right, you have 2 things: string+object.
>>
>> Add parenthesis on the right and transform it into a list.
>>
>> After that perl will understand you are assinging the first thing on
>> the list (from left) equals the first thing on the list (from right)
>> and so on.
>>
>> []'s
>>
>> Hernan Lopes
>>
>> On 7/30/13, 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