in reply to Reading in a text file with "multi line lines"


Here is one way to do it by setting $/ = '' to read the lines in paragraph mode (see perlvar) and then substituting out the eol characters:
#!/usr/bin/perl -w use strict; $/ = ''; while (<DATA>) { next unless /\S/; chomp; s{\\\n}{}g; print "Line: ", $_,"\n"; } __DATA__ this is a good \ nice day but not a good nice \ night This is a test line This is a another test \ Line This is \ a final test line
Which prints:
Line: this is a good nice day but not a good nice night Line: This is a test line Line: This is a another test Line Line: This is \ a final test line

--
John.