From:

Date:

February 1, 2005 13:48Subject:

Re: "Secret" operatorsMessage ID:

20050201214832.GA2280@efn.orgOn Tue, Feb 01, 2005 at 01:20:21PM -0500, Bernie Cosell wrote: > On 1 Feb 2005 at 12:36, Ronald J Kimball wrote: > > > ... A list assignment in scalar context > > returns the number of elements on the right-hand side of the assignment. > > Which is an odd inconsistency, because in list context a list assignment > returns the left-hand-side-list, so you might guess that in scalar > context it'd return the number of elements in the lhs list... But the lhs usually either has a fixed number of elements or includes arrays/hashes so the number of elements is arbitrarily large. Using the rhs allows common idioms like: while (my ($k, $v) = each %hash) { } Here list-context each returns 2 elements (a key/value pair) until the hash is exhausted, whereupon it returns 0 elements, terminating the loop.Thread Previous | Thread Next

- "Secret" operators by José Castro
- RE: "Secret" operators by McGlinchy, Alistair
- Re: "Secret" operators by Yitzchak Scott-Thoennes
- Re: "Secret" operators by José Castro
- RE: "Secret" operators by McGlinchy, Alistair
- Re: "Secret" operators by Rafael Garcia-Suarez
- Re: "Secret" operators by Bart Lateur
- Re: "Secret" operators by Andrew Savige
- Re: "Secret" operators by krohn-list-perl
- Re: "Secret" operators by Quantum Mechanic
- Re: "Secret" operators by philippe.bruhat
- Re: "Secret" operators by Quantum Mechanic
- Re: "Secret" operators by Sébastien Aperghis-Tramoni
- Re: "Secret" operators by philippe.bruhat
- Re: "Secret" operators by Chris Dolan
- Re: "Secret" operators by Andrew Savige
- Re: "Secret" operators by Yanick Champoux
- Re: "Secret" operators by philippe.bruhat
- Re: "Secret" operators by Eugene van der Pijll
- Re: "Secret" operators by merlyn
- Re: "Secret" operators by Andrew Savige
- Re: "Secret" operators by José Castro
- Re: "Secret" operators by Vladi Belperchinov-Shabanski
- Re: "Secret" operators by Yitzchak Scott-Thoennes
- Re: "Secret" operators by Peter Haworth
- Re: "Secret" operators by Jeff Yoak
- Re: "Secret" operators by José Castro
- Re: "Secret" operators by Vladi Belperchinov-Shabanski
- Re: "Secret" operators by Andy_Bach
- Re: "Secret" operators by Ronald J Kimball
- Re: "Secret" operators by Bernie Cosell
**Re: "Secret" operators**by Yitzchak Scott-Thoennes- Re: "Secret" operators by Quantum Mechanic
- Re: "Secret" operators by José Castro
- Re: "Secret" operators by Quantum Mechanic
- Re: "Secret" operators by José Castro
- Re: "Secret" operators by philippe.bruhat
- Re: "Secret" operators by Georg Moritz
- Re: "Secret" operators by philippe.bruhat
- Re: "Secret" operators by philippe.bruhat
- Re: "Secret" operators by Vladi Belperchinov-Shabanski
- Re: "Secret" operators by philippe.bruhat

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About