in reply to search for blank lines by RegEx

I suspect that you $line did not hold the whole data.
local $/; $_ = <STDIN>; my $blanks = () =~ /\n\n+/sg; print "double lines found ( $blanks )\n";
The example search for lines with two or more \n.
Boris