Hi Alan

How about:

    my $last = undef;

    while (<>)
    {
        next unless defined $last;
        chomp $last unless /^\./;
        print $last;
    } continue {
        $last = $_;
    }

    print $last;

HTH,

Rob

"Alan C." <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> It's now a previously formatted text block with line breaks at every 70
> characters width.
>
> And the block's first line begins with a leading period or dot as well
> as approximately every third line thereafter begins with a leading
> period or dot.
>
> How do I rid the block of line breaks on every line except for the lines
> that begin with the leading period or dot?
>
> I want to end up with a fewer number of lines whereby each of them is
> both longer and is preceded by the period or dot (sample output below).
> --
>
> #!/perl/bin/perl -w
> undef $/;    # Enter "file slurp" mode.
> $text = <>;  # This file/selection slurped into the scalar
> for ($text =~ s/\n\.//g) {
> print $text;
> }
>
> I tried the above removes each \nPERIOD combo, not quite yet what I want.
>
> I'm aware that split is an array but I don't yet know how to use split.
>   And I'm not sure if split is what is needed.
>
> How to, using regex, split, or otherwise?
> --
>
> --begin test sample text block--
> .WEDNESDAY...CLOUDY IN THE MORNING THEN BECOMING PARTLY CLOUDY.
> AREAS OF DENSE FOG IN THE MORNING. HIGHS 56 TO 61. LIGHT WINDS.
> .WEDNESDAY NIGHT...MOSTLY CLOUDY. PATCHY FOG OVERNIGHT. LOWS 41 TO
> 48. LIGHT WINDS.
> .THURSDAY...MOSTLY CLOUDY. SLIGHT CHANCE OF SHOWERS IN THE
> AFTERNOON. HIGHS 52 TO 57. SOUTHEAST WINDS 10 TO 15 MPH.
> .THURSDAY NIGHT...MOSTLY CLOUDY.
> --end test sample text block--
>
> .WEDNESDAY really long line
> .WEDNESDAY NIGHT really long line
> .THURSDAY really long line
>
> (my desired output)
>
> --
> Cheers!  Alan.
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to