in reply to RFC: List::Extract

Untested, but I have a knack at this... :)
sub extract (&\@) { my ($code, $aref) = @_; my @return; my @replace; for (@$aref) { # aliases $_ to the item in the original list if (&$code) { push @return, $_; } else { push @replace, $_; } } @$aref = @replace; return @return; }
To answer your last questions, it keeps modifications both to the input and output arrays.