You are not using a pattern which, to me, implies m// or index() use; you are actually using a code block.
Use a list of sub references to iterate over instead ...
@test = ( sub { $_[0] < 3 } ); for my $t ( @test ) { print join q[ ] , grep $t->( $_ ), 1 .. 5; }
In reply to Re: grep { $var } @arr
by Anonymous Monk
in thread grep { $var } @arr
by igelkott
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |