you put some effort formatting your questio and showing your attempt, but if i can ask for more, try to show some simplified data; infact having AAAA and ABAA instead of 160 chars line is the same problem.
That said, i notice a first error: you are, for each file to read, reopening also the output one using the mode > which will overwrite the file each time. Put the opening of the output file outside of the loop. Also Perl is smart enought to close filehandels for you (wwhen they go outside of a scope) but is better check the open and close filehandles explicitly. Second you are setting $/ to null enabling the so called slurp mode. Doing you influence what Perl see as line, becoming different from what you call a line.
Finally perhaps i dont understand your question clearly: why you want 4 lines to be printed? why the paragraphs which second line starts with TACAG must be associated to the (header?) line that contains 20279 and not with the one containing 18609 ?
L*
In reply to Re: count the occurrence of second line of a paragraph in a file
by Discipulus
in thread count the occurrence of second line of a paragraph in a file
by umaykulsum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |