next unless $. == $array[$i]; print $_; ++$i < @array or last;