my @giant_array = (defined elsewhere); while ( my $pid = findone{ matches_criteria($_) } @giant_array){ # Do something with element found. }