my $count = 0; my $seqlinec = 2; while ( ) { if ( $seqlinc eq $count ) { print "$_\n"; } $seqlinec += 4; } #### my $count = 0; while ( ) { next if ( !$count++ ); # ignore line zero, increase linecount print $_; $count = 0 if ($count >= 3); # reset the counter once we printed line 3 }