Is there a quick and easy way to grep through an array that finds elements that satisfy some tests and removes them from the original array?
For example, I would like
@a = (1, 7, 6, 3, 8, 4);
@b = grep_filter { $_ > 5 } @a;
In other words, I want to split an array into two arrays: those that match, and those that don't match a particular condition.
source
share