http://www.perlmonks.org?node_id=921413


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.