my @extracted; my $c = 0; while ($c < @$list) { local *_ = \$list->[$c]; if (do { ... }) { push @extracted, splice @$list, $c, 1; } else { $c++; } }