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

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

From:
Christoph Anton Mitterer
Date:
December 14, 2017 14:38
Subject:
Re: [perl #132557] perlbug AutoReply: improvements in perldata
Message ID:
1512881272.25544.30.camel@scientia.net
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,
2,
		with all elements being evaluated but the former
		discarded)

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',
'bar'];
$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.


Cheers,
Chris



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About