SUMMARY
Proposal for the "purge" command as the opposite of "grep" in the same way
that "unless" is the opposite of "if".
DETAILS
I've lately been going a lot of greps in which I want to keep all the
elements in an array that do *not* match some rule. For example, suppose
I have a list of members of a club, and I want to remove (i.e. "purge")
from the list everybody for whom the "quit" property is true. With grep
it's done like this:
@members = grep {! $_->{'quit'}} @members;
Obviously that works well enough, but just like "unless" somehow
simplifies the logic by removing that leading !, "purge" can simplifiy the
array filter:
@members = purge {$_->{'quit'}} @members;
FWIW, I came up with "purge" because my first inclination was to spell
"grep" backwards: "perg". :-)
-miko
Miko O'Sullivan
Programmer Analyst
Rescue Mission of Roanoke