in reply to Re: Quicly extracting odd index elements in the array with grep
in thread Quicly extracting odd index elements in the array with grep

How can I modify your code above, if given:
my @arr = (0,1,2,3,4,5,6,8,10); # # # # Giving $VAR = [1,4,8];
Namely, keep index-1 and then get index at interval 3 subsequently.

Replies are listed 'Best First'.
Re^3: Quicly extracting odd index elements in the array with grep
by tilly (Archbishop) on Aug 10, 2006 at 04:53 UTC
    my @arr = (0,1,2,3,4,5,6,8,10); my $ind = 0; my @result = grep {1 == $ind++ % 3} @arr;