while() { chomp; # find out if there's a line continuation # and remove the trailing backslash my $cont = s/\\\s*$//; # print without newline, no matter what print; # decide whether to end print with newline print "\n" unless $cont; } #### while () { s/\\\s*\n//; print; }