Re:Why Perl 6 is Different (2010)
by raiph on Tuesday January 12, 2016 @12:24PM
(#10888752)
> I could never remember how to dereference a value in an array or hash properly.
I too struggled with that and came to hate it.
Perl 6 directly addressed this and some related problems.
First, sigils are now invariant - they're just a part of the name that signals which of the three data structure types a particular variable is. Second, there's no need for a `->` dereferencing op.
my @array = 1,2,3; # `@` sigil means indexable var
say @array[1]; # prints 2
It might be interesting to look at an example. Perhaps you could share an example of code in Python that illustrates some data structuring code that would be confusing in Perl 5 syntax, I'll try show what the Perl 6 equivalent would be, and we can see if Perl 6 really does clean this part of the language up.
I too struggled with that and came to hate it.
Perl 6 directly addressed this and some related problems.
First, sigils are now invariant - they're just a part of the name that signals which of the three data structure types a particular variable is. Second, there's no need for a `->` dereferencing op.
It might be interesting to look at an example. Perhaps you could share an example of code in Python that illustrates some data structuring code that would be confusing in Perl 5 syntax, I'll try show what the Perl 6 equivalent would be, and we can see if Perl 6 really does clean this part of the language up.