File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -163,12 +163,15 @@ L<#Truncating slices> and the L<#:v> adverb.
163
163
Positional indices are counted from the start of the collection, but there's
164
164
also a notation for addressing elements by their position relative to the end:
165
165
C < *-1 > refers to the last element, C < *-2 > to the second-to-last element, and so
166
- on.
166
+ on. From version 6.d, C < *-0 > refers to the element just beyond the last one
167
167
168
168
my @alphabet = 'A' .. 'Z';
169
169
say @alphabet[*-1]; # OUTPUT: «Z»
170
170
say @alphabet[*-2]; # OUTPUT: «Y»
171
171
say @alphabet[*-3]; # OUTPUT: «X»
172
+ @alphabet[*-0] = 'þ';
173
+ say @alphabet;
174
+ # OUTPUT: «[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z þ]»
172
175
173
176
B < Note > : The asterisk, which is actually a L < C < Whatever > |/type/Whatever> , is
174
177
important. Passing a bare negative integer (e.g. C < @alphabet[-1] > ) like you
You can’t perform that action at this time.
0 commit comments