Re: replacing multiple blank lines with a single blank line

2002-02-01 Thread John W. Krahn
Larry Moore wrote: > > I want to slurp a file and make multiple blank lines into single blank > lines. Here is my code: > > [snip code] > > I have tried a number of substitutions but haven't found the correct > formulation. #! perl -w use strict; my $file = 'test.fmt'; open IN, $file or die

RE: replacing multiple blank lines with a single blank line

2002-01-31 Thread Jeff 'japhy' Pinyan
On Jan 31, Nikola Janceski said: >you want to treat $text as a single string >use >$text =~ s/\n+/\n/sg; # use /mg if you want to treat the string as multiple >lines. Your information about /s and /m is wrong. /s changes how . matches, and there is no . in your regex. /m changes how ^ and $ w

Re: replacing multiple blank lines with a single blank line

2002-01-31 Thread Curtis Poe
--- "Moore, Larry" <[EMAIL PROTECTED]> wrote: > I want to slurp a file and make multiple blank lines into single blank > lines. Here is my code: > > #! perl -w > use strict; > > my $file = "test.fmt"; > > open (IN, $file) or die; > open (OUT, ">>test.txt"); > > my $text; > > { > local

RE: replacing multiple blank lines with a single blank line

2002-01-31 Thread Nikola Janceski
you want to treat $text as a single string use $text =~ s/\n+/\n/sg; # use /mg if you want to treat the string as multiple lines. -Original Message- From: Moore, Larry [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 12:33 PM To: beginners@perl. org (E-mail) Subject: replacing