in reply to while loop not working
Then... What should ($final_gset[$i]), $tmps; do? I think you mean:
don't you?$final_gset[$i]= $tmps;
But what's the stop condition? Maybe this is, what you need:
Your foreach-loop can be shortened to:while (<IN>) { if ($hit=/POLYMORPH/ ... /^\s*$/) { # This will be reached for each line from # POLIMORPH to the next empty line (including) # In order to exclude the first (POLYMORPH) # and the last (empty) line, we do next if $hit==1 || $hit=~/e0/i; # If we gut a line of data, we append them # to our array push(@final_gset, $_); # and get the next line next; } # This will be reached for anything else }
print TEXT join("\n",@final_gset),"\n";
|
|---|