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?
In reply to Grep Pattern by GotToBTru
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |