I am very confused by your question. It is not at all clear what you are trying to do?

Your code has glaring errors, e.g.

for my $parse1 (@parse_terms1) { seek( $fh2, 0, 0 ); while ( my $parse2 = <$fh2> ) {
Never re-read the same file (in your code, your file handle <$fh2> and the seek) more than once without an exceptional reason. You have many loops within loops in this section of code the purpose of which are not at all clear.

You do not explain what parse1 or parse2 are intended to do. Or why they even should be separate files?

It looks like to me that you should use the files, parse1,2 to build a regex that is then executed over a number of directories and/or files?

I do not see any examples of what should "match" and what should "not match" with a simple example.

Your best bet is to start over and explain in English what you are trying to do. It would be helpful to me if you could show some simple examples of the input contained within the files and what you intend to match or not match. I simply do not understand enough about the problem to be of further assistance.


In reply to Re: Regex with two strings from files by Marshall
in thread Regex with two strings from files by Anonymous Monk

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.