use List::MoreUtils qw( firstidx ); sub cull_parv (&\@) { my ( $test , $array ) = @_; my @culled; while ( -1 < ( my $i = firstidx { &$test } @$array ) ) { push @culled , splice @$array , $i , 1 ; } return @culled; }