On Fri, Aug 08, 2008 at 11:08:51PM -0400, Brandon S. Allbery KF8NH wrote:
> On 2008 Aug 8, at 22:53, John M. Dlugosz wrote:
>> What is the difference between (1,2,3) and [1,2,3] ?
> IIRC one is a list, the other a reference to a list --- which in perl6
> will be hidden for the most part. so practically speaking the difference
> is minimal.
More directly, (1,2,3) will interpolate in list context, while
[1,2,3] will not.
say (1, 2, (3, 4, 5)).elems # 5
say (1, 2, [3, 4, 5]).elems # 3
The first example has a List containing five Ints, the second example
has a List containing two Ints and an Array.
It's also useful to consider the difference between:
$x = (3); # $x becomes an Int
$x = ; # $x becomes an Array