#!perl.exe my $file="infile.txt"; //stick infile in $contents open (FILE, $file) or die "Can't open $file: $!\n"; select((select(FILE), $/ = undef)[0]); my $contents = ; close (FILE); $contents =~ s/(\w)\r\n/($1) /mg; //attempt to fix wrapped //sentences open(OUTFILE, "## this is a wrapped line. "This is a wrapped quote." this first line is fine. so is this one. #### this is a wrapped line. "This is a wrapped quote." This first line is fine. So is this one.