Every other
David Cantrell
david at cantrell.org.uk
Fri Oct 30 22:41:26 GMT 2009
Damian Conway wrote:
> Mark Fowler <mark at twoshortplanks.com> wanted:
>
>> I have an array in Perl 5 [2]. I want *every* *other* element from it.
>
> Not especially fast, but very easy:
>
> use List::Maker;
>
> my @new = @old[ <0,2,..$#old> ];
That is splendidly magickal!
--
David Cantrell | A machine for turning tea into grumpiness
Support terrierism! Adopt a dog today!
More information about the london.pm
mailing list