In my snippet above the block is a fixed part of the grep statement. Is it possible to pass a block to the subroutine and use it within the grep statement?sub selected { my $arr_ref = shift; die "selected: need an arrayref" unless (ref $arr_ref eq "ARRAY"); return grep {($_ > 35)} @$arr_ref; }
In reply to How to pass blocks to subroutines by neniro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |