GotToBTru has asked for the wisdom of the Perl Monks concerning the following question:
I want to apply a F T T F repeating pattern as a filter to an array or list. Here is what I came up with:
$i = 0; @result = grep { $i = 0 unless ($i<4); $i++%3 ? 1 : 0; } 0..12
@result = 1,2,5,6,9,10
It works but looks clunky. Any more elegant options?
Back to
Seekers of Perl Wisdom