for my $datapoint (@FILE1) { my @found = grep {$_->contains($datapoint)} @interval_objects; say "$datapoint is in @found" if @found; }