my $linesToSkip = 2; while ( ) { next if 0 < $linesToSkip --; # Do something here with the lines of interest. ... } #### my $linesToSkip = 2; my $discard = for 1 .. $linesToSkip; while ( ) { # Do something here with the lines of interest. ... }