Assigning anonymous hash to a list

Joseph Werner telcodev at gmail.com
Tue Jul 30 22:32:18 BST 2013


On Tue, Jul 30, 2013 at 4:51 PM, Abigail <abigail at abigail.be> wrote:


> So?
>
> By that argument, this is a scalar assignment as well:
>
>   my ($i1, $i2, $i3) = (4, 5, 6);
>

No, What you have done here is to assigned a list value to an array of
assignable elements.

I am talking about the example at the top of this thread, which was a
scalar assignment to a list of elements.



And sorry if my message was not clean; here I only make the point that
the comma operator is a valid component of a Perl expression.

>>
>> The comma operator is a valid component of a Perl expression.
>>
>> my $str = 'text', {a => 1, b => 2, c => 3};
>> say $str;
>>
>> which gives:
>>
>> Useless use of anonymous hash ({}) in void context at test.pl line 5.
>> text


And here I refer to the subject expression of this thread.

>> Again, this is a simple assignment of a scalar value to the first
>> element of a list, precedence is not involved.
>
>
> Bzzzt. Wrong. Again.
>



-- 
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