One should even be able to shorten it to (can't test right now)
grep { (0,1,1,0)[ $_ % 4 ] } 0..12;
But it's not as DRY, cause you need to change the 4 if you change the list.
And of course it's not answering the OP s real question to filter any list.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re^4: Grep Pattern
by LanX
in thread Grep Pattern
by GotToBTru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |