in reply to Can't remember the term to search for help on!
You're talking about undefined $/. Reading a whole file at once is called "slurping the file" or "slurping the file's content".
my $file; { local $/; $file = <>; } $file =~ s/(?<!\n)\n(?!\n)//g print $file;
Usage for above:
perl script.pl infile > outfile perl -i.bak script.pl file # in-place
As a one-liner:
perl -0777pe's/(?<!\n)\n(?!\n)//g' infile > outfile perl -i.bak -0777pe's/(?<!\n)\n(?!\n)//g' file
|
|---|