On Sun, Mar 06, 2005 at 11:58:43PM -0800, Larry Wall wrote:
> On Sun, Mar 06, 2005 at 02:13:09AM -0700, Luke Palmer wrote:
> : What is output:
> : 
> :     sub foo($x, ?$y, [EMAIL PROTECTED]) {
> :         say "x = $x; y = $y; z = @z[]";
> :     }
> : 
> :     my @a = (1,2,3);
> :     foo($x, @a);
> 
> I think it should say something like:
> 
>     Use of undefined value at foo line 2
>     x = ; y = 1 2 3; z = 
> 
> Optional parameters are greedy, and @a means [EMAIL PROTECTED] in a scalar 
> context.
> 
> Larry

Urk. I, for one, will definitely find this surprising.  I would have
expected:

  x = <whatever>; $y = 1; z = 2 3

But I suppose it's all a question of learning to love the Brave New
World in which arrays are actually objects (sort of).

--Dks

-- 
[EMAIL PROTECTED]

Reply via email to