Here is a simple example where what is in the grep{} has nothing to do with the input list...an odd/even flip-flopper. Perl grep can do some very cool things that command line grep can't!
#!/usr/bin/perl -w use strict; my @test = qw (a b c d e f); my $is_even_flag =1; my @odd_tests = grep {$is_even_flag ^= 1; }@test; print "@odd_tests"; #prints b d f
In reply to Re^3: 'and' greps
by Marshall
in thread 'and' greps
by snmb_227
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |