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
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
--- "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
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