@input = ; $i = 0; foreach ($line (@input)) { $i++; if ($i >= 1034 || $i <= 1047) { #process here } } close FILE or die "can't close file: $!\n";