...the text I am concerned with is in an array (@ThisFileArray)...
A for loop is usually better for looping over an array.
...with paragraphs separated by an extra newline....
Perl can do that for you if you set $/ (see How can I read in a file by paragraphs?).
#!/usr/bin/perl use strict; use warnings; { local $/ = q{}; my @txt = <DATA>; for (@txt) { chomp; print qq{*$_*\n}; } } __DATA__ Text blah blah, make my point here. More text and even more continuing + on along the way. New paragraph starts here, there were 2 newlines just before I started + this paragraph, so I should somehow be able to match on that, but I can't figure out how to search for that throug +h my array.
*Text blah blah, make my point here. More text and even more continuin +g on along the way.* *New paragraph starts here, there were 2 newlines just before I starte +d this paragraph, so I should somehow be able to match on that, but I can't figure out how to search for that throug +h my array.*
Note that the extra pair of braces and local restricts the scope of the change to $/ (which is a global).

I've added stars instead of tags. I would seriously consider using something like HTML::Element's new method to deal with creating HTML tags. YMMV.


In reply to Re: question on multi line pattern matching for html formatting by wfsp
in thread question on multi line pattern matching for html formatting by tallCoolOne

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.