Hi,

Juerd wrote:
> Ingo Blechschmidt skribis 2005-09-06 19:46 (+0200):
>> If \(...) still constructs a list of references, are the following
>> assumptions correct?
> 
> IIRC, the RHS of \ is in scalar context, and the comma in scalar
> context (the parens are just for precedence), creates an arrayref.
> 
> Which is interesting (and imho, a bad idea), because:
> 
>>     \(@array);   # same as
> 
> \(@array) and [EMAIL PROTECTED] are the same thing

Agreed.

>>     \(@array,);  # same as
> 
> \(@array,) is [ @array ], NOT map { \$_ } @array

I'm not sure of the []s, remember &postcirumfix:<[ ]> creates *new*
containers:

    [EMAIL PROTECTED] = $bar;
    # @array[0] unchanged

Compare this to:

    (@array,)[0] = $bar;
    # @array[0] changed to $bar

So, I think, if we ditch Perl 5's special \(...),

    \(@array,);         # should be the same as
    \do { (@array,) };

This has the consequence that

    (\(@array,))[0] = $bar;

changes @array[0].


--Ingo

-- 
Linux, the choice of a GNU | Mr. Cole's Axiom: The sum of the
generation on a dual AMD   | intelligence on the planet is a constant;
Athlon!                    | the population is growing.  

Reply via email to