From: Nicholas Clark Date: Thu, 28 Sep 2000 17:12:42 +0000 (+0100) Subject: Document the issue (is not a syntax error, kind of) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c26893538723a2740afe1c2f89ea22856818835b;p=p5sagit%2Fp5-mst-13.2.git Document the issue (is not a syntax error, kind of) Subject: Re: [ID 20000901.011] the list (1,,3) ought to be a syntax error Message-ID: <20000928171242.K7924@plum.flirble.org> p4raw-id: //depot/perl@7116 --- diff --git a/pod/perldata.pod b/pod/perldata.pod index 65689a6..50b6858 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -540,6 +540,15 @@ has no effect. Thus ((),(),()) is equivalent to (). Similarly, interpolating an array with no elements is the same as if no array had been interpolated at that point. +This interpolation combines with the facts that the opening +and closing parentheses are optional (except necessary for +precedence) and lists may end with an optional comma to mean that +multiple commas within lists are legal syntax. The list C<1,,3> is a +concatenation of two lists, C<1,> and C<3>, the first of which ends +with that optional comma. C<1,,3> is C<(1,),(3)> is C<1,3> (And +similarly for C<1,,,3> is C<(1,),(,),3> is C<1,3> and so on.) Not that +we'd advise you to use this obfuscation. + A list value may also be subscripted like a normal array. You must put the list in parentheses to avoid ambiguity. For example: