Nice one.
The same but little bit more shortly:
sub grep2 (&@) { my $code = shift; my ($true, $false) = ([], []); push @{ &{$code}() ? $true : $false }, $_ for @_; return ($true, $false); }
In reply to Re: grep2 (like 'grep', but also return non-matches)
by ccn
in thread grep2 (like 'grep', but also return non-matches)
by blahblahblah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |