sub my_grep (&@) { my $sub = shift; my @out; $sub->() && push @out, $_ for @_; return @out; }