until is a looping construct. The entire loop is this:
push @group, $entire_file[$i] until ( $i % 5 == 0 );
Which can also be written as this:
while( $i % 5 != 0 ) { push @group, $entire_file[$i]; }
As you can see (or should be able to see if you've spent any time at all programming), $i never changes in this loop. ...so it will either not execute at all (if $i is a multiple of 5), or will execute forever otherwise. Well, "forever", until you fill your memory with copies of $entire_file[$i].
You might have intended something more along the line of:
push @group, $entire_file[$i] unless $i % 5 == 0;
That's not a looping construct -- it's just a conditional. In this way, $i will have its value change as the outer foreach loop progresses.
Dave
In reply to Re: Can I have some simple solution
by davido
in thread Can I have some simple solution
by sunil9009
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |