while (){ ...your code here... print; } #### while (<>) { chomp; if (s/\\$//) { $_ .= <>; redo; } # now process $_ }