while (($start, $end) = each %interval) { for $time (@time) { if ($time >= $start && $time < $end) { push @match, $time; } } }