Hello Datz_cozee75,

If your document isn’t too long, this approach should do what you want:

use strict; use warnings; use Data::Dump; my $first = 1; my $clause_number = 1; my @paragraphs; while (my $line = <DATA>) { if ($line =~ / ^ \d+ \. /x) { $line =~ s/ ^ \d+ /$clause_number/x; push @paragraphs, [ $line ]; ++$clause_number; $first = 0; } elsif ($first) { push @paragraphs, [ $line ]; $first = 0; } else { push @{ $paragraphs[-1] }, $line; } } for my $p (@paragraphs) { pop @$p while $p->[-1] eq "\n"; } dd \@paragraphs; __DATA__ Title 21. ASSIGNMENT: RESIDENT agrees not to transfer, assign or sublet the +premises or any part thereof. 22. PARTIAL INVALIDITY: Nothing contained in this Agreement shall be c +onstrued as waiving any of the OWNER'S or RESIDENT'S rights under the + law. If any part of this Agreement shall be in conflict with the law +, that part shall be void to the extent that it is in conflict, but s +hall not invalidate this Agreement nor shall it affect the validity o +r enforceability of any other provision of this Agreement. 32. RECEIPT OF AGREEMENT: The undersigned RESIDENTS have read and unde +rstand this Agreement and hereby acknowledge receipt of a copy of thi +s Barter Agreement. RESIDENT'S Signature _________________________________________________ +__ Date__________________ OWNER'S or Agent's Signature _________________________________________ +___ Date__________________

Output:

13:45 >perl 1796_SoPW.pl [ ["Title\n"], [ "1. ASSIGNMENT: RESIDENT agrees not to transfer, assign or sublet +the premises or any part thereof.\n", ], [ "2. PARTIAL INVALIDITY: Nothing contained in this Agreement shall +be construed as waiving any of the OWNER'S or RESIDENT'S rights under + the law. If any part of this Agreement shall be in conflict with the + law, that part shall be void to the extent that it is in conflict, b +ut shall not invalidate this Agreement nor shall it affect the validi +ty or enforceability of any other provision of this Agreement.\n", ], [ "3. RECEIPT OF AGREEMENT: The undersigned RESIDENTS have read and +understand this Agreement and hereby acknowledge receipt of a copy of + this Barter Agreement.\n", "\n", "RESIDENT'S Signature ____________________________________________ +_______\n", "\n", "Date__________________\n", "\n", "OWNER'S or Agent's Signature ____________________________________ +________\n", "\n", "Date__________________\n", ], ] 13:45 >

Then you can output @paragraphs with as many blank lines between each paragraph as you choose.

Update: Changed $paragraph to $clause_number in line with talexb’s good advice below.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: a simple match and replace script by Athanasius
in thread a simple match and replace script by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.