damian at conway.org
Fri Oct 30 21:07:08 GMT 2009
Mark Fowler <mark at twoshortplanks.com> wanted:
> I have an array in Perl 5 . I want *every* *other* element from it.
Not especially fast, but very easy:
my @new = @old[ <0,2,..$#old> ];
> There's very nice syntax for this in Perl 6, isn't there?
Yes. Several in fact. The nicest is:
my @new = @old[0,2...*];
That doesn't work yet in the current alpha release of Rakudo, but this
my @new = @old[ 0...*+2, 6 ];
More information about the london.pm