in reply to Removing double carriage return
A harder way would be to keep track of the types of consecutive lines seen while processing line by line. Print array contents only when n non-blank (however that is defined) consecutive lines are seen.
In Section
Seekers of Perl Wisdom