In generic item context an array returns a capture (think reference) to an array.
But in other item contexts, like boolean ?@array, numeric +@array and string ~@array the array will return different things (for example number of elements, and a string representation).
A scalar value that holds an array capture automatically dereferences, so you can write $ary[0] instead of the cludgy $ary->[0].
I don't know why this should make sigils useless. Sigils serve two purposes: visual distinction, and name disambiguation (%foo is a different variable than @foo).
Automatic dereferencing doesn't impact any of those.
It's like in Perl 5 - you can store everything in a scalar (or scalar ref), but you shouldn't, because it makes your program less readable.
But if you decide to do that in Perl 6, the syntax is nicer ;-)
Update: as a side note the braces after a variable are nothing special or magical in Perl 6, it just calls method postcircumfix:<[ ]>($invocant:, $argument) on the variable. So it's just natural that it works on a capture as well as on an array.
In reply to Re: [Perl 6] $ and @ - what is it coming to?
by moritz
in thread [Perl 6] $ and @ - what is it coming to?
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |