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
: replacing multiple blank lines with a single blank line
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
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 $/;
$text = ;
close IN;
}
# $text =~ s/\0{2,}/\0\0/mg; # this removes