# Taken from The Camel, 3rd ed. while (<>) { chomp; if (s/\\//) { $_ .= <>; redo unless eof; # don't read past each file's eof } # now proces $_ } #### # file_1 (this line doesn't belong to the file's content) Line one\ Line two #### # file_2 (this line doesn't belong to the file's content) Line three Line four\ # file_3 (this line doesn't belong to the file's content) Line five Line six #### # My code while (<>) { chomp; if (s/\\//) { unless (eof) { # don't read past each file's eof $_ .= <>; redo; } } # now process $_ }