http://qs321.pair.com?node_id=696383


in reply to append line to previous line in txt file

Hi mmittiga17,

If I understood your requirement correctly, you can do it in the below method, iff your file size is not huge.

use strict; use warnings; my $file = do {local $/, <DATA>}; #read the file from <DATA> $file =~ s/\n\;/\;/g; #replace newline followed by semicolon with semi +colon print $file; output: -------- asdfadfasdf asfadfasdf;asfadfasdfas fasfasdfas;asdfasdfasd asdfasdfasfd __DATA__ asdfadfasdf asfadfasdf ;asfadfasdfas fasfasdfas ;asdfasdfasd asdfasdfasfd

Prasad