- or download this
my $file; { local $/; $file = <>; }
$file =~ s/(?<!\n)\n(?!\n)//g
print $file;
- or download this
perl script.pl infile > outfile
perl -i.bak script.pl file # in-place
- or download this
perl -0777pe's/(?<!\n)\n(?!\n)//g' infile > outfile
perl -i.bak -0777pe's/(?<!\n)\n(?!\n)//g' file