my $findline = 10; while () { next unless $. == $findline; # .. do something last; #don't read any more }