open (DATAFILE3, $prog); while () { next if 1 .. 75; # flip-flop operator $line = $_; last; } # $line has the 76th line, do your stuff now. close(DATAFILE3);