> >> my $foo_count = () = param('foo');
> 
> Tillema,> Let me guess ... param('foo') is assigned to a list 
> Tillema,>... the list is assigned
> Tillema,> to $foo_count in a scalar context so the number of 
> Tillema,> elements are returned.
> 
> Tillema,> Right?
> 
> Probably simpler than that.  param is invoked in a list context,
> so it does its listy-thing, and returns a list of N elements.  This
> list attempts to be assigned to the () list, which tosses everything
> after the 0th element (that is, EVERYTHING) as unneeded.  However,
> since that list assignment op was in a scalar context, it returns
> the number of original elements (not the number of kept elements),
> and that's back to N again.  And that N goes into $foo_count.
> 
> There's never a "list assigned to $foo_count in a scalar context"...
> the phrase doesn't even make sense to me. :) You can't assign a list
> to $foo_count.  It can never happen.  Never.  A list cannot exist in a
> scalar context... the guts of Perl mandates that.
> 
> -- 
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

That's how it was phrased in the camel; "List assignment in scalar context
returns the number of elements produced by the expression on the _right_ side
of the assignment..."  Your explanation certainly goes into much more detail,
however. Thanks!


Glenn Tillema                  [EMAIL PROTECTED]
ADC Telecommunications, Inc.       
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

Reply via email to