in reply to RE: How do I remove blank lines from text files?
in thread How do I remove blank lines from text files?
This way you properly limit the scope of local $/ to just the lines you need it. And wont accidentilly screw yourself up later.open OUT, ">fixed" or die "Couldn't open fixed: $!"; open IN, "<junk" or die "Couldn't open junk: $!"; { local $/ = undef; ($_ = <IN>) =~ s/\n{2,}/\n/g; print OUT; } close IN; close OUT;
|
---|
Replies are listed 'Best First'. | |
---|---|
RE:(3) remove blank lines? (localizing block for $/)
by Russ (Deacon) on Jul 11, 2000 at 08:37 UTC |