neodymium has asked for the wisdom of the Perl Monks concerning the following question:
what I'm hoping for is that stuff like this:#!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 = <FILE>; close (FILE); $contents =~ s/(\w)\r\n/($1) /mg; //attempt to fix wrapped //sentences open(OUTFILE, "<outfile.txt"); //stick result in outfile print OUTFILE $contents; close OUTFILE;
will be changed to:this is a wrapped line. "This is a wrapped quote." this first line is fine. so is this one.
but its not at all working... the output file always seems to contain no characters at all... take pity on me... and help me fix this dismal kludge before I sleep. Thank you in advance.this is a wrapped line. "This is a wrapped quote." This first line is fine. So is this one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: replacement of newlines
by McDarren (Abbot) on Apr 14, 2006 at 07:10 UTC | |
|
Re: replacement of newlines
by spiritway (Vicar) on Apr 14, 2006 at 08:00 UTC | |
|
Re: replacement of newlines
by japhy (Canon) on Apr 14, 2006 at 15:04 UTC |