my @second; for my $element (@first) { push @second, $element if condition($element); }