Could you describe what it is that you are trying to do?
It looks like you are simply reading everything from one file and then appending it to another? Going by the output filename this is just a test, but if that is your intention , then an OS command would achieve this much more easily.
With regard to the body of the if statement, you are only reading one line after the section header. Is this your intent?
And if the intent of this line
($final_gset[$i]), $tmps;
is to assign the line you read in, into an element of the array, then where is the assignment? Ie. '='.
Basically, theere is no need to assign to a temporary var and then to the array, you might as well do this directly
if (/POLYMORPH/) $final_gset[$i] = <IN>; }
If that is your intent, then the other problem with your code is that you are never incrementing $i, so you are always over the same element. Except, that you have never assigned a value to $i, so it has the value undef, which is illegal as an array subscript.
If you had
use strict; use warnings;
at the top of your program, Perl would have probably told you most of this.
In reply to Re: while loop not working
by BrowserUk
in thread while loop not working
by harry34
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |