in reply to Why does my Perl regex substitution for linebreak fail?

what you are literally asking for ('I have a long file from which I want to remove a single linebreak before all lines starting with the string "= = = =".') is this:

#!/usr/bin/perl use strict; my $l; while (<DATA>) { if ($_ =~ /^====/) {chomp $l;} print $l; $l=$_; } print $l; __DATA__ one two ====three four