20 lines
200 B
Plaintext
20 lines
200 B
Plaintext
|
|
|
|
###
|
|
### cgrep
|
|
###
|
|
|
|
## Chapter 7 section 2
|
|
|
|
sub cgrep (&) {
|
|
my $f = shift;
|
|
my $r = sub {
|
|
my @result;
|
|
for (@_) {
|
|
push @result, $_ if $f->($_);
|
|
}
|
|
@result;
|
|
};
|
|
return $r;
|
|
}
|