Perl 6 Perl 6 Lists and Arrays vivified #61

More on slicing

> my @words = < orange lime cherry banana lemon >;

> say @words[0,4,2];
orange lemon cherry

> say @words[3..7];     # slice beyond the end of the list
banana lemon Any() Any() Any()

> say @words[3..Inf];   # now what...?
> say @words[3..*];     # now what...?

If a subscript is "known infinite", then slicing does an "autotrim" operation that stops at the first index beyond the end.

> say @words[3..*];     
banana lemon
Copyright © 2012
http://www.pmichaud.com/2012/pres/