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:
- You do "local $/" after an initial read from both ORGN and RECI file handles, so $ORGN and $RECI contain only the initial line of each file (contrary to what I struck out above)
- You enter your first while loop, while (my $G1A = <ORGN>) after doing "local $/", so there will be only one iteration of that loop.
- I'm guessing that you may have intended the second while loop to start with while($G2A=<RECI>) -- but this would likewise have only one iteration, since the input is being read in "slurp" mode.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.