>>>>> "Tillema," == Tillema, Glenn <[EMAIL PROTECTED]> writes:

>> my $foo_count = () = param('foo');

Tillema,> Let me guess ... param('foo') is assigned to a list ... the list is assigned
Tillema,> to $foo_count in a scalar context so the number of 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. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to