develooper Front page | perl.perl5.porters | Postings from December 2017

Re: [perl #132557] perlbug AutoReply: improvements in perldata

Christoph Anton Mitterer
December 14, 2017 14:38
Re: [perl #132557] perlbug AutoReply: improvements in perldata
Message ID:
Maybe one could also make a "definite list of all cases" in the form of
an example like:

$x = $s;	(scalar x is assigned the value of scalar s)
$x = @a;	(scalar x is assigned the length of array a)
$x = %h;	(scalar x is assigned the length, that is number of
		keys, of hash h)
$x = (1, 2);	(scalar x is assigned the last element of the list,
		with all elements being evaluated but the former

then the same for subscripts and slices e.g.:
$x = $a[3];
$x = $h['foo'];
$x = (1, 2)[1];
$x = @a[3,6];
$x = @h['foo', 'bar'];
$x = %h['foo',
$x = (1, 2, 3, 4)[1,3];

and then all of the above combinations again other left-hand side types:
- array
- hash
- list
and slices and subscripts thereof.

Such a list should point out the trivial cases like:
@x = $s  (list with one element)
and also tell about cases which are forbidden by syntax.

Chris Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About