What do you think your inner while loop is supposed to do? How many iterations do you think there should be of that loop? Here's how it starts:
while($G2A = $RECI ){
$RECI is a scalar variable containing a string that is all the data read from the file whose name ($a) is the current iterator on the outermost "foreach" loop.

The while statement quoted above simply assigns that same string value to $G2A. There is no "break" or "last" statement inside the loop, and nothing to alter the value of $RECI, so if the string is not empty, the while condition will always be true, and you'll be in an infinite loop. (Did you intend to use "==" instead of "="?)

I second the advice given above: if you still have a problem after fixing that inner while loop, show us a little input data and what the output is supposed to look like for that data.

UPDATE: (Sep. 9): I just happened to take another look at the code (having the perltidy version below really helps!), and I realized a couple more things about your handling of input files:


In reply to Re: How to do a reciprocal matching statement by graff
in thread How to do a reciprocal matching statement by ajl412860

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.